# Choose Database Dialog Box

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.

Use the dialog box as follows:

Element | Description
--- | ---
Reference | 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.
Service Locator Strategy | Choose to generate inline lookup code or use an existing class. You can click Browse to search for the existing class names.

Note: 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.

Related Topics

Developing Applications with NetBeans IDE,

Developing Applications with NetBeans IDE,

Developing Applications with NetBeans IDE,

Developing Applications with NetBeans IDE,

Copyright © 2015, Oracle and/or its affiliates. All rights reserved.