当前位置:首页 >> 网络编程

详解Spring Hibernate连接oracle数据库的配置

详解Spring Hibernate连接oracle数据库的配置

jdbc.properties文件配置如下 

driverClassName=oracle.jdbc.driver.OracleDriver 
url=jdbc\:oracle\:thin\:@localhost\:1521\: 
database=OA 
username=oa 
password=oa 
initialSize=2 
maxActive=10 
maxIdle=2 
minIdle=2 
removeAbandoned=true 
removeAbandonedTimeout=25200 
maxWait=30000 
validationQuery = select 1 from dual 
testOnBorrow=true 

bean.xml文件配置如下

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> 
 <property name="driverClassName" value="${driverClassName}"/> 
 <property name="url" value="${url}${database}"/> 
 <property name="username" value="${username}"/> 
 <property name="password" value="${password}"/> 
 <property name="initialSize" value="${initialSize}"/> 
 <property name="maxActive" value="${maxActive}"/> 
 <property name="maxIdle" value="${maxIdle}"/> 
 <property name="minIdle" value="${minIdle}"/> 
</bean>  

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!