- C3P0配置
<bean id="MysqlSmsDB" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass">
<value>${jdbc.mysqlDriver}</value>
</property>
<property name="jdbcUrl">
<value>${jdbc.mysqlUrl}</value>
</property>
<property name="user">
<value>${jdbc.mysqlUsername}</value>
</property>
<property name="password">
<value>${jdbc.mysqlPassword}</value>
</property>
<property name="initialPoolSize">
<value>1</value>
</property>
<property name="minPoolSize">
<value>1</value>
</property>
<property name="maxPoolSize">
<value>15</value>
</property>
<property name="maxIdleTime">
<value>1800</value>
</property>
<property name="acquireIncrement">
<value>2</value>
</property>
<property name="maxStatements">
<value>0</value>
</property>
<property name="testConnectionOnCheckout">
<value>false</value>
</property>
<property name="breakAfterAcquireFailure">
<value>false</value>
</property>
</bean>
- JNDI+Tomcat配置修改
1、Tomcat/conf/context.xml(记住你的 name =MysqlSmsDB
<Resource name="MysqlSmsDB"
auth="Container"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
maxWait="10000"
username=""
password=""
driverClassName=""
url=""/>
2、配置dataSource,指定jndiName的值MysqlSmsDB
<bean id="MysqlSmsDB" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"> <value>java:comp/env/MysqlSmsDB</value> </property>
</bean>