本文介绍了在GlassFish 3 Application Server中配置MySQL数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道在glassfish 3中配置mysql数据源的步骤吗?我被困在datasourceName应该是什么.这是我一直遵循的步骤.他们是正确的吗?我错过了一步吗?顺便说一句,我在Mac OSX Lion

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)使用XAMPP安装MySQL
  • 2)下载/jars/jdbc-drivers/mysql-connector-java-5.1.22并添加到CLASSPATH
  • 3)在Netbeans中,启动glassfish并启动Domain Admin Console
  • 4)转到常见任务">资源">"JDBC">"JDBC连接池",然后单击"NEW
  • ".
  • 5)池名称:MySQL
  • 资源类型:javax.sql.ConnectionPoolDataSource
  • 数据库驱动程序供应商:MySQL
  • 6)单击Next并向下滚动到Additional Properties (8)
  • 端口号:3306
  • databaseName:mygames//这是任意的
  • datasourceName:com.mysql.jdbc.Driver//我不确定这是正确的
  • roleName:
  • networkProtocol
  • serverName:本地主机
  • 用户:我的名字
  • 密码:mypassword
  • 7)单击完成.
  • 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.

我还有一个问题,是否有放置/jars/jdbc-drivers/mysql-connector-java-5.1.22的最佳位置?以及如何告诉DataSource设置如何到达它?

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?

推荐答案

我的配置实际上有效.我遇到的问题是将jar放在正确的目录路径中.我想我找到了,因为它在起作用:

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

这篇关于在GlassFish 3 Application Server中配置MySQL数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 02:34