Hibernate配置c3p0连接池
来源:互联网 发布:温度测量仪软件下载 编辑:程序博客网 时间:2024/06/08 07:09
首先,我们需要导入c3p0的jar包
我们可以直接在官方文件中的project--->etc文件夹下找到hibernate.properties文件,在该文件下,
我们可以找到c3p0的配置的相关信息
###########################
### C3P0 Connection Pool###
###########################
#hibernate.c3p0.max_size 2
#hibernate.c3p0.min_size 2
#hibernate.c3p0.timeout 5000
#hibernate.c3p0.max_statements 100
#hibernate.c3p0.idle_test_period 3000
#hibernate.c3p0.acquire_increment 2
#hibernate.c3p0.validate false
然后我们就相应地在hibernate.cfg.xml文件中进行配置
<!-- 配置c3p0连接池 --><!-- 最大连接数 --><property name="hibernate.c3p0.max_size">20</property><!-- 最小连接数 --><property name="hibernate.c3p0.min_size">1</property><!-- 获取连接超时时间,若超过这个时间会抛出异常,单位:毫秒 --><property name="hibernate.c3p0.timeout">5000</property><!-- 创建PreparedStatement对象的最大数量 --><property name="hibernate.c3p0.max_statements">100</property><!-- 每个指定时间检查连接池中的空闲连接,时间单位:秒 --><property name="hibernate.c3p0.idle_test_period">150</property><!-- 当连接池使用完毕,c3p0再和数据库建立n个连接放置到连接池中 --><property name="hibernate.c3p0.acquire_increment">2</property><!-- 每次都验证连接是否可用 --><property name="hibernate.c3p0.validate">true</property>
然后我们运行程序
当你看到与c3p0相关的类似信息,说明配置成功了
阅读全文
2 0
- hibernate c3p0 连接池配置
- hibernate C3P0连接池配置
- Hibernate配置C3P0连接池
- hibernate配置c3p0 连接池
- hibernate配置c3p0 连接池
- Hibernate C3P0连接池配置
- hibernate配置c3p0连接池
- hibernate配置C3P0连接池
- Hibernate配置C3P0连接池
- hibernate配置c3p0连接池
- Hibernate配置c3p0连接池
- hibernate配置c3p0连接池(lp)
- Hibernate 中配置C3P0连接池
- Hibernate 中配置C3P0连接池
- Hibernate中配置C3P0连接池
- Hibernate中配置C3P0连接池
- Hibernate中配置C3P0连接池
- Hibernate中配置C3P0连接池
- RecyclerView的基本使用、RecyclerView万能adapter及多条目的实现
- 请求网络数据后点击子条目Intent传值(简易)
- easymall第五天
- pwd命令
- GJJ的日常之再游戏
- Hibernate配置c3p0连接池
- bzoj2815 [ZJOI2012]灾难 支配树
- POJ 1426 Find The Multiple——bfs + 模运算 + 打表
- 边双联通模板
- 把数组中某个相等的值作为键重组数组
- 欢迎使用CSDN-markdown编辑器
- hpuoj--1410--QAQ & 火星情报局
- eCognition最邻近方法分类
- css选择器优先级和页面布局及css拓展