在JdonFramework中使用JNDI连接Mysql数据库问题?

07-06-22 yekongda
彭老师,根据您的实例(jboss+mysql)

小弟首先在jboss中mysql-ds.xml下自定义名Mark的JNDI,数据库名为mark

<local-tx-datasource>

<jndi-name>Mark</jndi-name>

<connection-url>jdbc:mysql://localhost:3306/mark?useUnicode=true&characterEncoding=UTF-8</connection-url>

<driver-class>com.mysql.jdbc.Driver</driver-class>

<message-name>banq</message-name>

<password>225034ba</password>

</local-tx-datasource>

然后在在jdonframework中设置

<pojoService name="constants" class="com.mark.test.Constants">

<constructor value="java:/Mark"/>

</pojoService>

在运行时报错??

WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null

org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: General error, message from server: "Access denied for user: '@localhost' to database 'mark'")

是不是在别的地方还要设置??

banq
2007-06-22 16:28
>Access denied for user: '@localhost' to database 'mark'

数据库没有授权banq用户访问,需要在mysql命令行执行:

GRANT ALL PRIVILEGES ON *.* TO banq@127.0.0.1 IDENTIFIED BY '225034ba' WITH GRANT OPTION;

yekongda
2007-06-22 16:55
哦,原来是这么回事,麻烦您了,刚以为这篇帖子没发上又在开源JdonFramework及其应用案例论坛版块发了篇,不好意思彭老师

猜你喜欢