1. 导入jar包两个

【jdbc】搭建c3p0数据源的环境

jar包下载:

https://github.com/winRh/csdn/blob/master/c3p0-0.9.1.2.bin.zip

https://github.com/winRh/csdn/blob/master/mysql-connector-java-5.1.7.zip

 

2. 在src目录下新建个c3p0-config.xml

3. 进入c3p0文档的主页(index.html)

【jdbc】搭建c3p0数据源的环境

4. 到附录B(Appendix B)复制c3p0-config.xml的例子

【jdbc】搭建c3p0数据源的环境

5. 复制到我们自己建的c3p0-config.xml里面,根据需要进行修改即可,比如

<?xml version="1.0" encoding="UTF-8"?>
<c3p0-config>
	
  <named-config name="mvcapp"> 
    <property name="user">root</property>
    <property name="password">888888</property>
    <property name="driverClass">com.mysql.jdbc.Driver</property>
    <property name="jdbcUrl">jdbc:mysql:///test</property>
    <property name="acquireIncrement">5</property>
    <property name="initialPoolSize">10</property>
    <property name="minPoolSize">10</property>
    <property name="maxPoolSize">50</property>

    <property name="maxStatements">20</property> 
    <property name="maxStatementsPerConnection">5</property>

  </named-config>
</c3p0-config>

 

相关文章:

  • 2022-01-01
  • 2021-04-02
  • 2021-06-20
  • 2021-12-24
  • 2022-12-23
  • 2021-09-13
  • 2021-04-28
  • 2021-11-04
猜你喜欢
  • 2021-05-16
  • 2021-07-30
  • 2021-09-26
  • 2021-12-27
  • 2021-08-26
  • 2021-10-06
  • 2021-11-11
相关资源
相似解决方案