彭老师,根据您的实例(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'") 是不是在别的地方还要设置??
>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;