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&useUnicode=true&characterEncoding=utf-8 </value>
</parameter>
</ResourceParams>
</Context>
------解决方案--------------------
找不到peng2所对应的数据库....配置问题..