2

i put mysql driver into glassfish/admin1/lib and i get this error on trying make a connection with GlassFish 3.1.2

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

Hare the configuration:

Pool Name: SimpleCRUD_ConnectionPool Resource Type: javax.sql.DataSource javax.sql.XADataSource Datasource Classname: com.mysql.jdbc.Driver

has someone any idea?

user2509556
  • 135
  • 1
  • 1
  • 7

3 Answers3

3

A Driver and a DataSource are not the same. It looks from your configuration that you're setting a Driver class as the DataSource classname?

Do you really need XA? Are you doing any distributed transaction?

If so, set the data source to com.mysql.jdbc.jdbc2.optional.MysqlXADataSource

If not, select a regular DataSource type and then set the classname to com.mysql.jdbc.jdbc2.optional.MysqlDataSource

TheArchitect
  • 2,161
  • 1
  • 12
  • 16
1

For starters, the path where you have placed your driver does not look correct. For details on administering database connectivity in Glassfish 3.1.2 please see 12 Administering Database Connectivity

Also in that guide you will find a section installing the MySQL Server Database Type 4 Driver

If you need additional help, please post a screen capture of your JDBC resource and JDBC connection pool configuration or if you used it the asadmin command you used to create it.

-Noah

NBW
  • 1,467
  • 2
  • 18
  • 27
1

No, you just lack mysql lib, just find and download mysql-connector-java-5.x.x-bin.jar copy to E:\Projects\glassfish3.1.1\glassfish\lib then restart server and enjoy !!!

Mike Nguyen
  • 1,024
  • 1
  • 11
  • 16
  • Placing the MySQL driver (or any JDBC driver) in the global lib directory is an anti pattern as that driver is then on the Classpath of every single application in every single domain. You should follow the guidelines in the Glassfish user guide instead. – NBW Jul 04 '14 at 16:21
  • Not necessarily. It depends on how you are using the driver. If you set up a global pool for a particular database instance that various application can use, what Paul is suggesting is reasonable. – Jubz Jul 19 '14 at 11:21
  • The glassfish documentation **says** to put in the lib folder...if not there, as, again, the Oracle documentation specifies, the *where* should the driver go? – Thufir Sep 15 '14 at 07:55
  • @Thufir If you follow the links to the Glassfish documentation in my answer below (specifically http://docs.oracle.com/cd/E26576_01/doc.312/e24928/jdbc.htm#gkpci) you will see it says to put the driver in the _domain_ lib dir, not the glassfish/lib dir as this answer is suggesting. – NBW Oct 14 '14 at 21:39
  • @Jubz Generally speaking that's not good practice. In the case of this answer there was no qualification and as such it is suggesting to the reader a specialized practice is the correct answer to a general use case and it is not. – NBW Oct 14 '14 at 21:44