2

I want to configure glassfish with my db. I create jdbc ressource like this:

  • jndi name: jdbc/MysqlDataSource
  • pool name : MysqlConnPoll

And i create my connection pool like this:

  • Pool Name: MysqlConnPoll
  • Ressource type: java.sql.driver
  • Driver classname: com.mysql.jdbc.driver

in Additional Properties

  • databaseName: name_db
  • user: root
  • password: ****
  • url: jdbc:mysql://localhost:3306/name_db
  • Port: 3306
  • ServerName: localhost

I add mysql-connecter-java and com.mysql.jdbc in "glassfish4/glassfish/domains/domain1/lib/ext"

And when i ping my connection with the site glassfish, i have this message

Ping Connection Pool failed for MySqlConnPoll. Class name is wrong or classpath is not set for : com.mysql.jdbc.Driver Please check the server.log for more details.

Why i have this message ? i forgot something ?

thanks

Biohazard401
  • 41
  • 1
  • 2
  • 11

2 Answers2

2

it seems that your driver name is wrong.

For ConnectorJ version 8 try:

com.mysql.cj.jdbc.MysqlDataSource

For older ones:

com.mysql.jdbc.jdbc2.optional.MysqlDataSource

This is how to configure the Datasource Classname field for MySQL 8:

Datasource Classname setting

skomisa
  • 16,436
  • 7
  • 61
  • 102
Uwe Bretschneider
  • 1,211
  • 8
  • 12
1

I've just learnt JDBC last week, not sure I can help.

I have got something like this too after creating a new domain in glassfish4.0 and try to create a connection pool with that new domain. After a few tries and errors, I got it to work.

I added the connector .jar in "glassfish4/glassfish/domains/domain1/lib" rather than inside the "glassfish4/glassfish/domains/domain1/lib/ext" like you mention. Maybe you can try that and see.

not sure if this help: while connecting to database, I also use the same .jar (meaning pointing to the same file) when specifying the driver.