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:
- 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.
- 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.
- Click OK.
- When you create a new reference name for a data source you need to choose a data source in your project or on the server.
If the data source does not exist, you must create the data source by specifying the JNDI name and database connection
for the data source.
- See Also
- About Connection Pools
- Using a Service Locator
- Connecting
to a Database
- Adding a New
JDBC Driver
Legal Notices