[C3P0]XML文件配置及使用
来源:互联网 发布:淘宝宝贝下架后在哪里 编辑:程序博客网 时间:2024/06/05 20:23
总文件c3p0-config.xml配置:
<?xml version="1.0" encoding="UTF-8"?><c3p0-config> <default-config> <property name="automaticTestTable">con_test</property> <property name="checkoutTimeout">30000</property> <property name="idleConnectionTestPeriod">30</property> <property name="initialPoolSize">10</property> <property name="maxIdleTime">30</property> <property name="maxPoolSize">100</property> <property name="minPoolSize">10</property> <property name="maxStatements">200</property> <!-- 配置mysql数据库配置 --> <property name="driverClass">com.mysql.jdbc.Driver</property> <property name="user">root</property> <property name="password">1234</property> <property name="jdbcUrl">jdbc:mysql://localhost:3306/mybatis</property> <user-overrides user="test-user"> <property name="maxPoolSize">10</property> <property name="minPoolSize">1</property> <property name="maxStatements">0</property> </user-overrides> </default-config> <!-- This app is massive! --> <named-config name="intergalactoApp"> <property name="acquireIncrement">50</property> <property name="initialPoolSize">100</property> <property name="minPoolSize">50</property> <property name="maxPoolSize">1000</property> <!-- intergalactoApp adopts a different approach to configuring statement caching --> <property name="maxStatements">0</property> <property name="maxStatementsPerConnection">5</property> <!-- he's important, but there's only one of him --> <user-overrides user="master-of-the-universe"> <property name="acquireIncrement">1</property> <property name="initialPoolSize">1</property> <property name="minPoolSize">1</property> <property name="maxPoolSize">5</property> <property name="maxStatementsPerConnection">50</property> </user-overrides> </named-config></c3p0-config>
工具类Conn:
public class Conn { private static ComboPooledDataSource c3p0 = new ComboPooledDataSource (); //获取链接对象 public static Connection getConnection() throws SQLException{ Connection connection = c3p0.getConnection(); return connection; } //释放资源 public static void close (Connection connection){ if(connection!=null){ try { DbUtils.close(connection); } catch (SQLException e) { e.printStackTrace(); } } }}
1 0
- [C3P0]XML文件配置及使用
- C3P0.xml文件配置
- c3p0 使用及配置说明
- c3p0-config.xml文件基本配置
- c3p0-config.xml配置与使用
- Hibernate中配置C3P0数据源步骤及hbm.xml 文件详解
- xml文件参数配置及使用
- applicationContext.xml配置c3p0
- C3P0的XML配置
- c3p0-config.xml配置
- Hiberate hibernate.cfg.xml 及c3p0连接池配置实例
- 在spring框架中的applicationContext.xml文件配置c3p0数据源
- 关于c3p0文件配置
- applicationContext.xml里面配置c3p0
- XML文件配置使用
- C3P0配置与使用
- C3P0配置与使用
- C3P0配置使用
- Prime Palindromes--回文+素数判断
- java设计模式——结构型之门面模式
- 短信防火墙
- 第三周项目3:输出星号图
- 链式队列
- [C3P0]XML文件配置及使用
- c语言中逗号运算符和逗号表达式
- 常见排序算法的Java实现
- 受限玻尔兹曼机RBM实现及能量值思考——matlab实现
- hadoop集群搭建攻略
- 在CentOS上安装Java环境详解
- python 多线程学习
- css怎样让背景充满整个屏幕
- 在RHEL7或者OL7上,Documents Fail to Index with DRG-11207: user filter command exited with status 127