总结:SPRNG2.5.6+IBATIS
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" />
</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" ref="sqlMapClient" />
</bean>
<bean id="supplierDao" />
?
<bean
value="sql-map-config.xml" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="dataSource"
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>
============sql-map-config.xml==============<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"? ? "http://www.ibatis.com/dtd/sql-map-config-2.dtd">?
?