Friday Sep 07, 2012

JDBC Connection Pools in Glassfish

I've been attempting to configure Glassfish 3.1.2.2 for ADF 11g and the need arose to create a jdbc connection pool to my Oracle XE 11g database. While this is really very trivial there were no samples of how to do this and documentation, while good, rarely ever provides concrete examples. After fumbling around for a few minutes searching for an example I gave up and figured it out on my own. Here are the steps for any of you that may be in need.

This can be done either via the Glassfish command line tool asadmin or through the admin console. I'm doing this through the admin console.

  • Start Glassfish and connect to the admin console with the credentials you defined at installation: http://localhost:4848
  • Navigate to Resources | JDBC | JDBC Connection Pools and select New. Be sure to enter Resource Type & Datasource Classname under General Settings tab. You can go with the defaults for Pool Settings etc... View Image
  • Go to the Additional Properties tab and create username, password, and url properties with the respective values. View Image
  • Navigate to Resources | JDBC | JDBC Resources and select New. Be sure to enter the JNDI Name and select the Pool Name for the jdbc connection pool you created previously. View Image
  • Navigate to Configurations | server-config | JVM Settings and select the JVM Options tab. Add the values highlighted: -Doracle.jdbc.J2EE13Compliant=true is used to make sure the driver behaves in a JEE-compliant manner. View Image
  • To integrate the JDBC driver into a GlassFish Server domain, copy the JAR files into the domain-dir/lib directory, then restart the server. The JAR file for the Oracle 11 database driver is ojdbc6dms.jar.
    • Note: You can also use the glassfish provided jdbc driver oracle.jdbc.drivers/ojdbc6.jar. This is sufficient to copy into the lib directory.
  • Last thing, once you've configured your datasource, is to test it out. You can invoke a ping from the JDBC Connection Pool console to validate the db connection setup.

This is the datasource you will use for ADF Essentials 11.1.2.3 that just went live today (09/24/2012) so download the new ADF Essentials now! You will have to take a short survey prior to downloading the new ADF Essentials.

See Shay's blog on Deploying ADF Essentials Applications to Glassfish.

About


I'm a Principal Product Manager in the JDeveloper/ADF product management team. I've been working with JDeveloper since 2004.
twitter
YouTube

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today