Sie sind auf Seite 1von 2

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

Confirm that a JDBC driver for your database is registered with the IDE. The registered JDBC drivers are visible under the Drivers node in the Services window. Create a database connection for the database. A database connection is represented by a database connection node ( node in the Services window. ) under the Databases

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. 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, select the Data Input Mode, which can be either a field entry or a direct JDBC database URL. The Data Input Mode option defines only the form in which you want to specify the database connection settings: either type the host name, port, and database name in separate fields or use a direct URL. 5. Confirm that the correct driver for your database is selected in the Driver Name list. 6. If you selected the Field Entry option, enter the host name, port, and database name in the respective fields. You can select the Show JDBC URL checkbox to see the actual URL for the new connection. If you selected Direct URL Entry for the Data Input Mode, enter 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. 7. Provide the user name and password, if required by your database configuration. 8. 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. 9. Click OK to create the database connection and connect to the database from the IDE.

When connecting to the database, the schema with the same name as the user name is set as default, but if a schema with that name does not exist, you are automatically switched to the Advanced Tab of the Connect dialog box to select a schema.

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.

Das könnte Ihnen auch gefallen