MySQL JDBC Connection in Glassfish

Start to add a new JDBC Connection Pools.

* Goto Resources-> JDBC -> JDBC Connection Pools
* Click New…
* Enter a pool name (identyfy the pool, free text)
* Choose java.sql.Driver
* Click Next
* Enter com.mysql.jdbc.Driver in Driver Classname
* Add additional properties:

Name Value
URL jdbc:mysql://localhost:3306/<databaseName>?zeroDateTimeBehavior=convertToNull
user <username>
password <password>

* Click on finish

 

Create a new JDBC Resource
* Goto Resources-> JDBC -> JDBC Resources
* Click New…
* Enter jdbc/ as JNDI Name
* Choose the Pool the you created above as Pool Name
* Click OK

Download mysql-connector-java-.jar to the glassfish4/glassfish/lib mapp (https://dev.mysql.com/downloads/connector/j/5.0.html)


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *