当前位置: 代码迷 >> Java Web开发 >> org.apache.commons.dbcp.SQLNestedException:   Cannot  
  详细解决方案

org.apache.commons.dbcp.SQLNestedException:   Cannot  

热度:385   发布时间:2016-04-17 17:03:44.0
问题解决,立刻给分,在线等(数据连接池的问题)
org.apache.commons.dbcp.SQLNestedException:   Cannot   create   PoolableConnectionFactory   (Syntax   error   or   access   violation   message   from   server:   "Unknown   database   'peng2 ' "),我用的是mysql的数据库,而且数据库确实存在,配置文件为:

<?xml   version= '1.0 '   encoding= 'utf-8 '?>
<Context   displayName= "peng2 "   docBase= "peng2 "   path= "/peng2 "   reloadable= "true "   workDir= "work/Catalina/localhost/peng2 ">
<!--   peng2   -->
<Resource   name= "peng2 "   auth= "Container "   type= "javax.sql.DataSource "/>
<ResourceParams   name= "peng2 ">
<parameter>
<name> factory </name>
<value> org.apache.commons.dbcp.BasicDataSourceFactory </value>
</parameter>
<parameter>
<name> maxActive </name>
<value> 200 </value>
</parameter>
<parameter>
<name> maxIdle </name>
<value> 10 </value>
</parameter>
<parameter>
<name> maxWait </name>
<value> 12000 </value>
</parameter>
<parameter>
<name> removeAbandoned </name>
<value> true </value>
</parameter>
<parameter>
<name> removeAbandonedTimeout </name>
<value> 20 </value>
</parameter>
<parameter>
<name> logAbandoned </name>
<value> true </value>
</parameter>
<parameter>
<name> username </name>
<value> root </value>
</parameter>
<parameter>
<name> password </name>
<value> root </value>
</parameter>
<parameter>
<name> driverClassName </name>
<value> org.gjt.mm.mysql.Driver </value>
</parameter>
<parameter>
<name> url </name>
<value> jdbc:mysql://localhost/peng2?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf-8 </value>
</parameter>

</ResourceParams>
</Context>


------解决方案--------------------
找不到peng2所对应的数据库....配置问题..
  相关解决方案