用tomcat5.5.9 配置mysql4.1的连接池时出错!!!
出错信息:Cannot load JDBC driver class 'com.mysql.jdbc.Driver '
server.xml部分内容:
<Resource name= "jdbc/bbs " auth= "Container " type= "javax.sql.DataSource " maxActive= "50 " maxIdle= "5 " maxWait= "3000 " username= "root " password= "root " driverClassName= "com.mysql.jdbc.Driver "url= "jdbc:mysql://localhost:3306/bbs "/>
<parameter>
<name> factory </name>
<value> org.apache.commons.dbcp.BasicDataSourceFactory </value>
</parameter>
web.xml部分内容:
<resource-ref>
<description> DB Connection </description>
<res-ref-name> jdbc/bbs </res-ref-name>
<res-type> javax.sql.DataSource </res-type>
<res-auth> Container </res-auth>
</resource-ref>
测试代码为:
Connection conn = null;
DataSource ds = null;
Context ctx = new InitialContext();
ds = (DataSource) ctx.lookup( "java:comp/env/jdbc/bbs ");
if (ds != null) {
conn = ds.getConnection();
}
return conn;
我有一个 "mysql-connector-java-3.2.0-alpha-bin.jar "的驱动包放到了WEB-INF\lib下
还是出现了:Cannot load JDBC driver class 'com.mysql.jdbc.Driver '的错误
如果我不用连接池就不会出现这种错误!!
有谁知道怎么解决吗????
------解决方案--------------------这样配.驱动.应该放在tomcat里的common\lib目录下...