configuring a MySQL DataSource in GlassFish 3 Application Server

你离开我真会死。 提交于 2019-12-25 07:55:10

问题


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 to Additional 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!