<strong>db.driverClass=org.gjt.mm.mysql.Driver db.jdbcUrl=jdbc:mysql://localhost:3306/test db.user=root db.password=root # db.initialPoolSize=20 db.maxIdleTime=60 db.maxPoolSize=200 db.minPoolSize=50 # db.acquireIncrement=3 db.acquireRetryDelay=1000 db.acquireRetryAttempts=30 db.breakAfterAcquireFailure=false</strong> |
<!-- 数据库连接池管理 -->
<bean id="c3p0DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${db.driverClass}"></property>
<property name="jdbcUrl" value="${db.jdbcUrl}"></property>
<property name="user" value="${db.user}"></property>
<property name="password" value="${db.password}"></property>
<property name="initialPoolSize" value="${db.initialPoolSize}"></property>
<!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property name="maxIdleTime" value="${db.maxIdleTime}"></property>
<!--连接池中保留的最大连接数。Default: 15 -->
<property name="maxPoolSize" value="${db.maxPoolSize}"></property>
<property name="minPoolSize" value="${db.minPoolSize}"></property>
<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
<property name="acquireIncrement" value="${db.acquireIncrement}"></property>
<!--两次连接中间隔时间,单位毫秒。Default: 1000 -->
<property name="acquireRetryDelay" value="${db.acquireRetryDelay}"></property>
<!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
<property name="acquireRetryAttempts" value="${db.acquireRetryAttempts}"></property>
<!--获取连接失败将会引起所有等待连接池来获取连接的线程抛出异常。但是数据源仍有效保留,并在下次调用getConnection()的时候继续尝试获取连接。如果设为true,那么在尝试
获取连接失败后该数据源将申明已断开并永久关闭。Default: false -->
<property name="breakAfterAcquireFailure" value="${db.breakAfterAcquireFailure}"></property>
</bean>