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:
- 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.
- If you are deploying to the Sun Java System Application Server, you can also generate
a connection pool and data source for the database connection by selecting
the Create Server Resources checkbox. The resources are created under the
project's Server Resources node.
- Select the database to which you want to connect in the Connection drop-down
list. If the database is not listed, do the following:
- If the JDBC driver for the database server is not registered in the
IDE, click Add Driver.
- Click Add Connection to connect to the database.
- 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.
- See Also
- About Connection Pools
- Using a Service Locator
- Connecting
to a Database
- Adding a New
JDBC Driver
Legal Notices