日期:2014-05-17  浏览次数:20830 次

c3p0连接池如何连接oracle?
我目前用是spring+hibernate;连接池一直都在用c3p0,但是之前用的都是mysql数据库,现在要求用oracle数据库,突然发现不会用C3P0和oracle的连接配置,一直都在用DBCP充数,很让人郁闷的问题。想求一个详细的配置说明和注意事项。谢谢!!!

邮箱:hantong4510@163.com
QQ:296222242

教 的对的就统统加分

------解决方案--------------------
Spring文件中配置:
<!--加载 c3p0 连接池配置属性文件 -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:c3p0.properties</value>
</list>
</property>
</bean><!--
配置连接池各属性的值
-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${jdbc.driverClass}" />
<property name="jdbcUrl" value="${jdbc.jdbcUrl}" />
<property name="user" value="${jdbc.user}" />
<property name="password" value="${jdbc.password}" />
<property name="minPoolSize" value="${jdbc.miniPoolSize}" />
<property name="maxPoolSize" value="${jdbc.maxPoolSize}" />
<property name="initialPoolSize" value="${jdbc.initialPoolSize}" />
<property name="maxIdleTime" value="${jdbc.maxIdleTime}" />
<property name="acquireIncrement" value="${jdbc.acquireIncrement}" />
<property name="acquireRetryAttempts" value="${jdbc.acquireRetryAttempts}" />
<property name="acquireRetryDelay" value="${jdbc.acquireRetryDelay}" />
<property name="testConnectionOnCheckin" value="${jdbc.testConnectionOnCheckin}" />
<property name="idleConnectionTestPeriod" value="${jdbc.idleConnectionTestPeriod}" />
<property name="checkoutTimeout" value="${jdbc.checkoutTimeout}" />
</bean>
c3p0.properties文件中:
jdbc.driverClass=oracle.jdbc.OracleDriver
jdbc.jdbcUrl = jdbc:oracle:thin:@localhost:1521:orcl
jdbc.user = scott
jdbc.password = tiger
jdbc.miniPoolSize = 1
jdbc.maxPoolSize = 30
jdbc.initialPoolSize = 1
jdbc.maxIdleTime = 25000
jdbc.acquireIncrement = 1
jdbc.acquireRetryAttempts = 30
jdbc.acquireRetryDelay = 1000
jdbc.testConnectionOnCheckin = true
jdbc.idleConnectionTestPeriod = 18000
jdbc.checkoutTimeout=3000

------解决方案--------------------
探讨
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

这个是什么意思????