domenica 27 marzo 2011

Glassfish + MySQL JDBC Connection Pool

I used MySQL Workbench 5.2 (http://wb.mysql.com/) in order to create the Database. Next step was to use the Glassfish Administration console to configure a JDBC Connection Pool and JDBC Resources. I followed the tutorial visible at this page http://www.albeesonline.com/blog/2008/08/06/creating-and-configuring-a-mysql-datasource-in-glassfish-application-server/.

These are my values:

JDBC Connection Pool
Pool Name: SIPool
Resource Type: javax.sql.DataSource
Database Vendor: MySQL

Additional Properties
portNumber: 3306
databaseName: sidatabase
serverName: localhost
user: root
password: root
URL: jdbc:mysql://localhost:3306/sidatabase
url: jdbc:mysql://localhost:3306/sidatabase

By clicking on the Ping button I received the Ping Succeeded Message meaning that my connection was correctly configured.

Then I created a JDBC Resource using the JNDI Name jdbc/snowinstructions referring to the Connection Pool created before (SIPool).

Note that we need to have the mysql-connector-java-bin.jar (http://www.mysql.com/downloads/connector/j/) library inside the glassfish/lib folder in order to get everything right.

Nessun commento:

Posta un commento