Connecting to a Database

See Also

To connect to a database you first need to do the following:

When you create a database connection, you supply the details needed to connect to a specific database. The details needed to connect to a database include the location of the database, which driver to use and the username and password information.

After you create the database connection you can do the following:

To create a new connection:

  1. Confirm that your database is running.
  2. In the Services window, confirm that the appropriate JDBC driver for your database is listed under the Drivers node.
  3. Right-click the Databases node and choose New Connection.

    Alternatively, expand the Drivers node, right-click your driver's instance node and choose Connect Using.

  4. In the New Database Connection dialog box, confirm that the correct driver is selected in the Driver field.
  5. Provide the JDBC database URL for the database connection in the Database URL field.

    This URL typically begins with jdbc:and a short code name for the driver, followed by another colon. The rest of the URL depends on the type of driver you are using. For example, you might need to specify a host and port; alternatively, the name of a database file might suffice, or an ODBC DSN. For MySQL, the Database URL might look as follows:

    jdbc:mysql://localhost:3306/mydatabase
    To help you get started, the IDE provides templates for the correct URL format for the most common drivers. If in doubt, refer to the documentation for the driver that you are using.

  6. Provide the user name and password, if required by your database configuration.
  7. Click the Remember Password checkbox to have the IDE remember your password.

    If selected, you will not be prompted for the user name and password on subsequent connections to the database. To change this property, right-click the database connection node in the Services window and choose Properties and unselect the Remember Password property in the Properties window.

  8. Click OK to create the database connection and connect to the database from the IDE.

If the connection is successful, the database connection node appears as a subnode of the Databases node. The database connection node appears whole (  ) indicating the database is connected. When the database is connected, you can expand the database connection node to see the child folders representing lists of tables, views and procedures. For more, see Browsing Structures.

If the connection attempt fails, the IDE displays a dialog box indicating it was unable to add the connection. Check the connection information for the database in the New Database Connection dialog box.

To disconnect from the database:

  1. Right-click the database connection node and choose Disconnect.

    You cannot browse the database until you reconnect to the database.

See Also
Adding a JDBC Driver

Legal Notices