Choose Database Dialog Box

See Also

You use this dialog box to add code to a Java class file that looks up a networked database. You can choose to specify an existing class containing the lookup code or the IDE can generate the lookup code for you. The lookup code uses a reference name that refers to the JNDI name of your data resource. If there is no reference name associated with your data resource, you can create a new reference name in the dialog box.

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 Insert Code > Use Database.

You use the dialog box as follows:

  1. Select the name of the resource reference from the drop-down list. The resource reference refers to the JNDI name of the data source you want to use. If no resource reference to your data source is available in the drop-down list, click Add to create a new reference name.
  2. 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.
  3. Click OK.
See Also
About Connection Pools
Using a Service Locator
Connecting to a Database
Adding a New JDBC Driver

Legal Notices