libs:
c3p0-0.9.1.2.jar
jtds-1.2.5.jar
commons-logging.jar
log4j-1.2.15.jar
spring.jar
ibatis-2.3.4.726.jar
环境:JDK1.6+SPRING2.5.6+IBATIS2
DB:SQLSERVER2000(驱动JTDS,c3p0连接池)
=====Spring配置如下(service.xml)============
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<import resource="sql-map-daos.xml" />
<bean id="productService" class="com.me.service.ProductService">
<property name="productDao">
<ref bean="productDao" />
</property>
</bean>
...
</beans>
============sql-map-daos.xml===========
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="productDao" class="com.me.dao.ibatis.SqlMapProductDao">
<property name="sqlMapClient" ref="sqlMapClient" />
</bean>
<bean id="supplierDao" class="com.me.dao.impl.SupplierDaoImpl" />
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:conn/jdbc.properties</value>
</property>
</bean>
<bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="sql-map-config.xml" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driverClassName}" />
<property name="jdbcUrl" value="${jdbc.url}" />
<property name="user" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="minPoolSize" value="1" />
<property name="initialPoolSize" value="2" />
<property name="maxPoolSize" value="20" />
<property name="maxIdleTime" value="1800" />
<property name="acquireIncrement" value="2" />
<property name="maxStatements" value="3" />
<property name="idleConnectionTestPeriod" value="1800" />
<property name="acquireRetryAttempts" value="3" />
</bean>
</beans>