Create Data Source Dialog Box

This dialog box enables you to create a data source (JDBC resource) which provides applications with a means of connecting to a database. To connect to a database, the JNDI name of the data source is used to locate the associated database. Typically, the administrator creates a data source for each database accessed by the applications deployed in a domain. (However, more than one data source can be created for a database.)

To create a data source to use in your application, you need to supply the following:

Element Description

JNDI Name

The JNDI name is the unique name for the data source. The JNDI name of the data source must also be registered on the target server.

Note: Because the data source is a JDBC resource, the JNDI name is expected in the java:comp/env/jdbc subcontext. For example, for a database name MyDatabase, specify jdbc/MyDatabase as the JNDI name.

Database Connection

Choose the database connection to your database from the drop-down menu. The data source refers to a specific database connection. The drop-down menu contains the database connections listed under the Databases node in the Services window. Choose New Database Connection to create a new database connection.

When you create a new data source for your application, the data source description is added to glassfish-resources.xml under the Server Resources node of your project in the Projects window. If you are deploying to the GlassFish server, the data source is registered with the server upon deployment.


Related Topics

Developing Applications with NetBeans IDE, "

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0.