blob: 028060f0a5e94babd840763987dc576a17bec840 [file] [log] [blame]
<!--
Copyright (c) 2005, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<p><a id="task-jdbcresourcenew" name="task-jdbcresourcenew"></a><a id="GHJDB00032" name="GHJDB00032"></a></p>
<h4><a id="sthref6" name="sthref6"></a>To Create a JDBC Resource</h4>
<a name="BEGIN" id="BEGIN"></a>
<p>A Java DataBase Connectivity (JDBC) resource (data source) provides applications with the means of connecting to a database.</p>
<a id="sthref7" name="sthref7"></a>
<h5>Before You Begin</h5>
<p>To create a JDBC resource, you must first create a JDBC connection pool. See <a href="task-jdbcconnectionpoolnew.html">To Create a JDBC Connection Pool</a>.</p>
<ol>
<li>
<p>In the navigation tree, expand the Resources node.</p>
</li>
<li>
<p>Under the Resources node, expand the JDBC node.</p>
</li>
<li>
<p>Under the JDBC node, select the JDBC Resources node.</p>
<p>The JDBC Resources page opens.</p>
</li>
<li>
<p>On the JDBC Resources page, click New.</p>
<p>The New JDBC Resource page opens.</p>
</li>
<li>
<p>In the JNDI Name field, type a unique resource name.</p>
<p>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 <code>jdbc/</code> string, for example, <code>jdbc/payrolldb</code>. Don't forget the forward slash.</p>
<p>The name must contain only alphanumeric, underscore, dash, or dot characters.</p>
</li>
<li>
<p>From the Pool Name drop-down list, select a connection pool to be associated with the new JDBC resource.</p>
</li>
<li>
<p>In the Description field, type a short description of the new JDBC resource.</p>
</li>
<li>
<p>Select the Status Enabled checkbox to make the resource available at runtime.</p>
<p>This option is enabled by default.</p>
</li>
<li>
<p>In the Additional Properties section, specify additional properties.</p>
<p>GlassFish Server does not define any additional properties for JDBC resources.</p>
<p>To add a property, click the Add Property button. In the blank row that appears, type the property name in the Name field, and type the property value in the Value field.</p>
</li>
<li>
<p>Select an Available Target to Add it or remove it from the Selected Targets list.</p>
</li>
<li>
<p>Click OK.</p>
</li>
</ol>
<a id="sthref8" name="sthref8"></a>
<h5>See Also</h5>
<ul>
<li>
<p><a href="task-setdbaccess.html">To Set Up Database Access</a></p>
</li>
<li>
<p><a href="task-integratejdbcdriver.html">To Integrate a JDBC Driver</a></p>
</li>
<li>
<p><a href="task-jdbcresourcesedit.html">To Edit a JDBC Resource</a></p>
</li>
<li>
<p><a href="task-jdbcresourcetargets.html">To Edit JDBC Resource Targets</a></p>
</li>
<li>
<p><a href="task-jdbcresourcesdelete.html">To Delete a JDBC Resource</a></p>
</li>
<li>
<p><a href="task-jdbcconnectionpoolnew.html">To Create a JDBC Connection Pool</a></p>
</li>
<li>
<p><a href="task-jdbcconnectionpooledit.html">To Edit JDBC Connection Pool General Settings</a></p>
</li>
<li>
<p><a href="task-jdbcconnectionpooladvance.html">To Edit JDBC Connection Pool Advanced Attributes</a></p>
</li>
<li>
<p><a href="task-verifyconnpoolsettings.html">To Verify Connection Pool Settings</a></p>
</li>
<li>
<p><a href="task-jdbcconnectionpoolproperty.html">To Edit JDBC Connection Pool Properties</a></p>
</li>
<li>
<p><a href="task-jdbcconnectionpooldelete.html">To Delete a JDBC Connection Pool</a></p>
</li>
</ul>
<small>Copyright &#169; 2005, 2017, Oracle and/or its affiliates. All rights reserved. <a href="docinfo.html">Legal Notices</a></small>