连接池struts-config.xml里配置
<struts-config>下
<data-sources>
<data-source key="mysqlDB" type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName" value="org.gjt.mm.mysql.Driver" />
<set-property property="url" value="jdbc:mysql://localhost/db" />
<set-property property="maxActive" value="100"/>
<set-property property="username" value="root"/>
<set-property property="password" value="root"/>
<set-property property="autoCommit" value="true"/>
</data-source>
</data-sources>
调用
ServletContext sc=servlet.getServletContext();
DataSource ds=(DataSource)sc.getAttribute("mysqlDB");
DbOper.DbOper dboper=new DbOper.DbOper(ds);
提供
commons-collections-3.2.1.jar
commons-dbcp.jar
commons-pool-1.4.jar
和一个c3p0包下载
c3p0-0.1.9.0.4.jar
黑色头发:http://heisetoufa.iteye.com/