日期:2014-05-18  浏览次数:20732 次

struts与mysql数据源连接问题
<data-sources>
<data-source   key= "mysql "   type= "org.apache.struts.util.GenericDataSource ">                                                                                                            
<set-property   property= "autoCommit "   value= "true "/>
<set-property   property= "driverClass "   value= "com.mysql.jdbc.Driver "/>
<set-property   property= "url "   value= "jdbc:mysql://127.0.0.1:3306/students "/>
<set-property   property= "maxCount "   value= "10 "/>
<set-property   property= "minCount "   value= "1 "/>
<set-property   property= "username "   value= "root "/>
<set-property   property= "password "   value= "admin "/>
</data-source>
</data-sources>
启动Tomcat6.0后出现以下异常:
信息:         createConnection()
2007-3-23   14:53:55   org.apache.struts.action.ActionServlet   initModuleDataSources
严重:   Initializing   application   data   source   mysql
java.sql.SQLException:   Access   denied   for   user   ' '@ 'localhost '   (using   password:   YES)
at   com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
at   com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:771)
at   com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3649)
at   com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1176)
at   com.mysql.jdbc.Connection.createNewIO(Connection.java:2558)
at   com.mysql.jdbc.Connection. <init> (Connection.java:1485)
at   com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at   org.apache.struts.legacy.GenericDataSource.createConnection(GenericDataSource.java:805)
at   org.apache.struts.legacy.GenericDataSource.open(GenericDataSource.java:741)
at   org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1085)
at   org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at   javax.servlet.GenericServlet.init(GenericServlet.java:212)
at   org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at   org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
at   org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4044)
at   org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at   org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at   org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at   org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at   org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at   org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at   org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at   org.apache.catalina.startup.HostCon