우선 dbcp를 사용하기위해 필수 라이브러리 3개를 받습니다.
http://commons.apache.org/
commons-collections.jar
commons-pool.jar
commons-dbcp.jar
라이브러리 추가 후 applicationContext에 아래와 같이 추가 합니다.
<!-- MySQL사용중일 경우 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
<property name="driverClassName" value = "com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/DB명" />
<property name="username" value="DB아이디" />
<property name="password" value="DB패스워드" />
<property name="url" value="jdbc:mysql://localhost:3306/DB명" />
<property name="username" value="DB아이디" />
<property name="password" value="DB패스워드" />
</bean>
<!-- xmlns:p="http://www.springframework.org/schema/p" 사용일 경우 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://localhost:3306/DB명"
p:username="DB아이디" p:password="DB패스워드" />
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://localhost:3306/DB명"
p:username="DB아이디" p:password="DB패스워드" />