JDBC Connection Pools in Glassfish

Posted by Dana Singleterry on Oracle Blogs See other posts from Oracle Blogs or by Dana Singleterry
Published on Fri, 7 Sep 2012 13:17:57 +0000 Indexed on 2012/09/07 15:44 UTC
Read the original article Hit count: 467

Filed under:

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.
An upcoming entry will demonstrate configuring Glassfish for Oracle ADF Applications.

© Oracle Blogs or respective owner

Related posts about /GlassFish