Choose Database Dialog Box

See Also

You use this dialog box to insert look-up code for a networked database into a Java class file. The lookup code looks for a data source with the given JNDI name and attempts to retrieve a connection to it.

You can only insert database look-up code in Java classes that are located in an EJB module project or web application project. You open the dialog box by right-clicking the class in the Source Editor and choosing Enterprise Resources > Use Database.

You use the dialog box as follows:

  1. Enter a JNDI name for the database connection. This name must be the same as the JNDI name of the JDBC data source for the database on the target server.
  2. Select the database to which you want to connect in the Connection drop-down list. If the database is not listed, do the following:
    1. If the JDBC driver for the database server is not registered in the IDE, click Add Driver.
    2. Click Add Connection to connect to the database.
  3. Under Service Locator Strategy, specify whether to generate inline lookup code or use an existing service locator. You can click the Browse to search for the service locator class name.
  4. Click OK.
See Also
About Connection Pools
Using a Service Locator
Connecting to a Database
Adding a New JDBC Driver

Legal Notices