c3p0

来源:互联网 发布:c语言英语单词 编辑:程序博客网 时间:2024/04/30 08:05
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"        destroy-method="close">        <property name="driverClass">            <value>${hibernate.connection.driver}</value>        </property>        <property name="jdbcUrl">            <value>${hibernate.connection.url}</value>        </property>        <property name="user">            <value>${hibernate.connection.username}</value>        </property>        <property name="password">            <value>${hibernate.connection.password}</value>        </property>        <property name="acquireIncrement">            <value>${c3p0.acquireIncrement}</value>        </property>        <property name="initialPoolSize">            <value>${c3p0.initialPoolSize}</value>        </property>        <property name="minPoolSize">            <value>${c3p0.minPoolSize}</value>        </property>        <property name="maxPoolSize">            <value>${c3p0.maxPoolSize}</value>        </property>        <property name="maxIdleTime">            <value>${c3p0.maxIdleTime}</value>        </property>        <property name="idleConnectionTestPeriod">            <value>${c3p0.idleConnectionTestPeriod}</value>        </property>        <property name="maxStatements">            <value>${c3p0.maxStatements}</value>        </property>        <property name="numHelperThreads">            <value>${c3p0.numHelperThreads}</value>        </property>        <property name="acquireRetryAttempts">            <value>${c3p0.acquireRetryAttempts}</value>        </property></bean>


 

 

C3P0 

可使用

 

properties 

配置文件方式,将

c3p0.properties

放在

classpath

目录下,如果为

WEB

应用,放在

WEB-INF\classes

 

c3p0.properties 

# This file is detritus from various testing attempts 

# the values below may change, and often do not represent 

# reasonable values for the parameters. 

 

 

c3p0.jdbcUrl=jdbc:oracle:thin:@127.0.0.1:1521:chenchi 

c3p0.driverClass=oracle.jdbc.driver.OracleDriver 

c3p0.user=hbota2 

c3p0.password=ty1234 

 

 

c3p0.minPoolSize=3 

c3p0.maxPoolSize=20 

 

 

#c3p0.testConnectionOnCheckout=true 

#c3p0.testConnectionOnCheckin=true 

 

 

#c3p0.checkoutTimeout=2000 

#c3p0.idleConnectionTestPeriod=5 

#c3p0.maxConnectionAge=10 

#c3p0.maxIdleTime=2 

#c3p0.maxIdleTimeExcessConnections=1 

#c3p0.propertyCycle=1 

#c3p0.numHelperThreads=10 

#c3p0.unreturnedConnectionTimeout=15 

#c3p0.debugUnreturnedConnectionStackTraces=true 

#c3p0.maxStatements=30 

#c3p0.maxStatementsPerConnection=5 

#c3p0.maxAdministrativeTaskTime=3 

#c3p0.preferredTestQuery=SELECT 1 

#c3p0.preferredTestQuery=SELECT a FROM emptyyukyuk WHERE a = 5 

#c3p0.preferredTestQuery=SELECT a FROM testpbds WHERE a = 5 

#c3p0.usesTraditionalReflectiveProxies=true 

#c3p0.automaticTestTable=PoopyTestTable 

#c3p0.acquireIncrement=4 

#c3p0.acquireRetryDelay=1000 

#c3p0.acquireRetryAttempts=60 

#c3p0.connectionTesterClassName=com.mchange.v2.c3p0.test.AlwaysFailConnectionTester 

#c3p0.initialPoolSize=10 

com.mchange.v2.log.MLog=com.mchange.v2.log.log4j.Log4jMLog 

#com.mchange.v2.log.MLog=com.mchange.v2.log.jdk14logging.Jdk14MLog