To store, organize, and retrieve data, most applications use relational databases. Java EE applications access relational databases through the JDBC API.
A JDBC resource (data source) provides applications with a means of connecting to a database. Before creating a JDBC resource, first create a JDBC connection pool.
To create a JDBC resource, specify a unique JNDI name that identifies the resource. Expect to find the JNDI name of a JDBC resource in java:comp/env/jdbc subcontext. For example, the JNDI name for the resource of a payroll database could be java:comp/env/jdbc/payrolldb. Because all resource JNDI names are in the java:comp/env subcontext, when specifying the JNDI name of a JDBC resource in the Administration Console, enter only jdbc/name. For example, for a payroll database specify jdbc/payrolldb.
To create a JDBC resource using the Admin Console, select Resources > JDBC Resources. Specify the resources settings as follows:
JNDI Name: Specify a unique name. The JNDI name organizes and locates components within a distributed computing environment similarly to the way that card catalogs organize and represent locations of books in a library. Consequently, the JNDI name becomes an important method of accessing the JDBC resource. By convention, the name begins with the jdbc/ string. For example: jdbc/payrolldb. Don’t forget the forward slash.
Pool Name: Choose the connection pool to be associated with the new JDBC resource.
Description: Type a short description of the resource.
Status: If you want the resource to be unavailable, deselect the Enabled checkbox. By default, the resource is available (enabled) as soon as it is created.
To create a JDBC resource using the command-line utility, use the create-jdbc-resource command.