This topic demonstrates setting up a connection to a MySQL database from GlassFish ESB — NetBeans IDE 6.1.
Connections to databases are managed using database drivers, which enable applications written in different programming languages to interact with the database management system. GlassFish ESB — NetBeans IDE 6.1 comes bundled with the MySQL Native (mysql-connector-java-5.1.5-bin.jar), which is a Java implementation of the JDBC API, and communicates directly with the MySQL Driver.
Click Services tab.
Expand the Drivers node from the Database Explorer. Right-click the MySQL (Connector/J driver) and choose Connect Using....
The New Database Connection dialog box is displayed.
In the Basic Setting tab, enter the Database's URL <HOST>:<PORT>/<DB> in the corresponding text field.
The URL identifies the type and location of a database server.
In this example, specify the host name (that is, the location of the server), the port number on which the database communicates, and the name of the database instance.
In this case you can enter: jdbc:mysql://localhost:xxxx/MyNewDatabase.
Enter User Name and Password.
Select the Remember password option. This is optional.
Click OK to accept the credentials.
This displays a new Connection node in the Database Explorer under the Databases node.
Click OK to accept the default schema.
Right-click the MySQL Database URL in the Services window (Ctrl-5). Click Connect.
This opens the New Database Connection dialog box.
The illustration shows that the Database Connection is enabled.
You are now connected to the MySQL RDBMS in the IDE.