Skip navigation

This article will show how to create connection pool and JDBC resource in Glassfish so it can be use in an EJB 3 for database connection. This is Glassfish v2 by the way.

– Place database jdbc lib on $GLASSFISH_HOME/lib

First, start Glassfish ($GLASSFISH_HOME/bin/asadmin start-domain domain-name), then go to admin page

Let’s create connection pool for MySql:
1. Select Resources –> JDBC –> Connection Pools, then click new… button.


2. Enter connection pool name, resource type, and database vendor. then click next.

3. on page 2, scroll down to bottom of the page. And set Additional Properties with your own environtment. Like DatabaseName, User, Password, Port, ServerName, URL, etc. Then click finish.

4. We can see our connection pool we had just create on the list. Click on the connection pool name.

5. Click Ping button to see if the connection is succeed.


6. Now we create JDBC resource using connection pool we had just create. Select Resources –> JDBC –>JDBC Resources, then click New… button


7. Enter JNDI name, Pool name, etc. JNDI name ussualy in format “jdbc/JNDI_NAME”. Then click OK


8. JDBC Resources is created


Now lets test it. to see if the JDBC connection pool and resource we had just created is working. I use EJB 3 on this.

(to be continued…)


One Comment

  1. Thank You! I was able to successfully ping my connection pool

One Trackback/Pingback

  1. […] eingeben während Glassfish läuft. Eine gute Anleitung zur Hochzeit findet man hier und […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: