Saturday, June 8, 2013

Database Conections problem in Glassfish3

A problem encountered for NGS-web project.

Problem: 
When I deleted glassfish3 and reinstalled it in a (slightly) different directory, the database connection of NGS-MySql (the icon you see in the bottom Eclipse panel: Data Source Explorer) could no longer be connected to MySQL database (complaining JDBC driver class not found). MySQL installation was intact, though.

Cause:
This is caused by the change in the JDBC driver location, when you reinstalled Glassfish3 to a different directory, even through you placed the mysql-connector-5.1.25-bin.jar to the $domain1/lib directory.

Solution:
In the bottom panel of Eclipse:
-> under the tab of 'Data Source explorer'
-> right click on your data source 'NGS-web'
->  prperties
-> on the left side list, choose 'Driver Properties'
-> on the far right side: there are two small icons, click the blue TRIANGLE icon: 'edit drive definition'
-> choose the tab 'JAR List'
-> Add JAR/Zip and locate your file of 'mysql-connector-5.1.25-bin.jar' !!
-> done.

Last but not list, you still want to make sure this JDBC drive is located in the $domain1/lib directory and present in the Java Classpath list:
Right click your project -> Properties -> search 'Java Build Path' and you will see it.


No comments:

Post a Comment