ssh 使用proxool连接池

最近做了个绩效系统 使用了proxool连接池技术 连接用到的连接文件 proxool.xml 放在src目录下
内容 连接的为oracle10g


<something-else-entirely>
<proxool>
<alias>perevaDB</alias>
<driver-url>
jdbc:oracle:thin:@localhost:1521:SID
</driver-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<driver-properties>
<property name="user" value="username"/>
<property name="password" value="passowrd" />
</driver-properties>
<house-keeping-sleep-time>9000</house-keeping-sleep-time>
  <proxool.simultaneous-build-throttle>50</proxool.simultaneous-build-throttle>
<prototype-count>5</prototype-count>
<maximum-connection-count>100</maximum-connection-count>
<minimum-connection-count>10</minimum-connection-count>
<house-keeping-test-sql>select CURDATE()</house-keeping-test-sql>
</proxool>
</something-else-entirely>



spring配置文件 读取proxool.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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<!-- 声明一个 会话工厂配置属性 自动获得会话-->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
destroy-method="close">
<property name="hibernateProperties">
<props>
<!-- 使用proxool配置类型-->
<prop key="hibernate.connection.provider_class">
org.hibernate.connection.ProxoolConnectionProvider
</prop>
<!-- proxool配置文件,注意路径 -->
<prop key="hibernate.proxool.xml">proxool.xml</prop>
<!-- 别名要和proxool.xml文件配置中的相一致 -->
<prop key="hibernate.proxool.pool_alias">
perevaDB
</prop>
<!-- 使用oracle10 版本 -->
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle10gDialect
</prop>
<!-- 在执行显示hibernate执行脚本 -->
<prop key="hibernate.show_sql">true</prop>
<!-- 在执行显示hibernate执行脚本 -->
<prop key="hibernate.format_sql">false</prop>
<!-- 在程序里自动关闭 session -->
<prop key="current_session_context_class">thread</prop>
</props>
</property>
<!--加载hibernate配置文件--!>
<property name="mappingDirectoryLocations">
<list>
<value>classpath*:com/model</value>
</list>
</property>
</bean>
<!-- 声明一个 Hibernate 3 的 事务管理器供代理类自动管理事务用 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>

<!-- 声明式事务管理 只对包含sav updat edit del add的方法用事务控制-->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="sav*" propagation="REQUIRED" timeout="30" />
<tx:method name="updat*" propagation="REQUIRED" timeout="30" />
<tx:method name="edit*" propagation="REQUIRED" timeout="30" />
<tx:method name="del*" propagation="REQUIRED" timeout="30" />
<tx:method name="add*" propagation="REQUIRED" timeout="30" />
<tx:method name="RowsLogin*" propagation="REQUIRED" timeout="30" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="CommonDAOpoint"
expression="execution(* com.service.inter.*.*(..))" />
<aop:advisor advice-ref="txAdvice"
pointcut-ref="CommonDAOpoint" />
</aop:config>


</beans>



另外在项目中需要导入两个连接池需要的文件
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值