网上关于C3P0在spring中的配置,几乎没有完全正确的(至少我还没发现)。查了c3p0的文档,又试验过N次。得出如下配置是正确的:
class="com.mchange.v2.c3p0.ComboPooledDataSource">
value="oracle.jdbc.driver.OracleDriver">
value="jdbc:oracle:thin:@127.0.0.1:1521:db">
1
20
1800
2
0
2
1800
30
true
false
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
org.hibernate.dialect.Oracle9Dialect
true
true
auto
true
true
ht/gisoa/entity/CmppSubmitCache.hbm.xml
ht/gisoa/entity/CmppDeliver.hbm.xml
ht/gisoa/entity/CmppSubmit.hbm.xml
ht/gisoa/entity/CmppReport.hbm.xml
ht/gisoa/entity/SGpstraceinfo.hbm.xml
ht/gisoa/entity/SDeviceinfo.hbm.xml
ht/gisoa/entity/SLbstraceinfo.hbm.xml
ht/gisoa/entity/Lbsschemainfo.hbm.xml
spring hibernate C3P0 连接池 详细配置
1.下载c3p0
2.导入包
3.配置c3p0a
1. 下载c3p0
2.在工程中导入c3p0包
3.配置c3p0 数据库连接池(我用的Oracle)
3.1 我用的是Spring+Hibernate,数据库是在Spring中配置
直接把
改为c3p0的配置就可以了
如下:
destroy-method="close">
以下的配置,只需要引用bean就可以了
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
阅读(1647) | 评论(1) | 转发(0) |