问题
Does anyone know the steps for configuring a mysql datasource in glassfish 3? I am stuck on what the datasourceName
should be. Here are the steps I have been following. Are they correct? Am I missing a step? BTW, I have glassfish 3.1.2
installed as part of Netbeans 7.2
on Mac OSX Lion
- 1) Install MySQL using XAMPP
- 2) Download /jars/jdbc-drivers/mysql-connector-java-5.1.22 and add to CLASSPATH
- 3) From Netbeans, start glassfish and launch
Domain Admin Console
- 4) Go to Common Tasks > Resources > JDBC > JDBC Connection Pools and click
NEW
- 5) Pool Name: MySQL
- Resource Type: javax.sql.ConnectionPoolDataSource
- Database Driver Vendor: MySQL
- 6) Click
Next
and scroll down toAdditional Properties (8)
- portNumber: 3306
- databaseName: mygames // this is arbitrary
- datasourceName: com.mysql.jdbc.Driver // I am not sure this is correct
- roleName:
- networkProtocol
- serverName: localhost
- user : myname
- password: mypassword
- 7) click finish.
One of the questions I still have, is there a best location to put /jars/jdbc-drivers/mysql-connector-java-5.1.22
? And how do I tell the DataSource setup how to reach it?
回答1:
My configuration actually works. The problem I was having was placing the jar in the correct directory path. I think I found it, because it's working:
/Applications/NetBeans/glassfish-3.1.2.2/glassfish/lib
来源:https://stackoverflow.com/questions/12655842/configuring-a-mysql-datasource-in-glassfish-3-application-server