Setup Glassfish JDBC Resource using Admin Console for Oracle Database

This is meant to be a reference for me anytime I use oracle with a JavaEE project. I hope it benefits you as well. This is pretty much remade from the reference at the end, so its easy for me to find at a later time.

In the default Glassfish 4.1.1 shipped with Netbeans 8.1 there is a problem with the admin console when trying to do certain things. Amongst them is adding JDBC Resource. I decided I would use Glassfish 4.1 to solve that problem but you are welcome to find a guide on how to setup a JDBC Resource in command line instead as an alternative. It’s a problem with that Glassfish version, not Netbeans.

My Build

  • Glassfish 4.1
  • Oracle Database 11g XE


First off, we need to make a connection pool. I already made mine, its called Oracle11g so don’t be startled if it doesn’t appear.

Navigate to Resources > JDBC > JDBC Connection Pools

Step 1


Set the values as below, to use oracle.jdbc.pool.OracleDataSource ensure you have ojdbc_6.jar (or whatever version is appropriate for you).

Step 2


Then set the additional properties values. I cut out my password and username in the diagram, fill it with your own values. Click save after completing. 1521 is the default port for oracle db 11g, if yours differs change it accordingly.

Step 3


Next we need to create a JDBC Resource.

Navigate to Resources > JDBC > JDBC Resources

Step 4


Fill in the values as below. The pool name should be that which you set when you made a new Connection Pool a few steps ago.ora-jdbc-con-pool-5

The following step ONLY applies if you are using JavaEE. This is to ensure that your jdbc driver behaves in a way which is compliant with JavaEE.

IF YOU DO NOT NEED THIS STEP then you need to restart the domain on glassfish to apply. With the default domain this can be done as

/path_to_glassfish/bin/asadmin restart-domain domain1

Navigate to Configurations > server-config > JVM Settings

Step 6

In the JVM Options tab, add a new option then save.

Step 7

Don’t forget to restart your domain.

/path_to_glassfish/bin/asadmin restart-domain domain1