当前位置导航:炫浪网>>网络学院>>编程开发>>JAVA教程>>Java进阶

在Hibernate中配置Proxool连接池

在Hibernate中配置Proxool连接池
1:在applicationContext.xml中配置SessionFactory
<bean id="sessionfactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
            <prop key="hibernate.show_sql">true</prop>
            <!--指定Proxool配置文件-->
            <prop key="hibernate.proxool.properties">conf/proxool.properties</prop>
            <!--<prop key="hibernate.proxool.xml">conf/proxool.xml</prop>-->
            <!--指定Proxool的alias,必须与Proxool的配置文件中的alias一致-->
            <prop key="hibernate.proxool.pool_alias">hibernate-oracle</prop>
        </props>
    </property>
</bean>
2:配置Proxool(conf/proxool.properties)
#jdbc-0.proxool.alias=mysql
#jdbc-0.proxool.driver-class=org.gjt.mm.mysql.Driver
#jdbc-0.proxool.driver-url=jdbc:mysql://localhost:3306/contestdb?user=root&password=1234&useUnicode=true&characterEncoding=utf8
#jdbc-0.user=root
#jdbc-0.password=1234

jdbc-0.proxool.alias=hibernatea-oracle
jdbc-0.proxool.driver-class=oracle.jdbc.driver.OracleDriver
jdbc-0.proxool.driver-url=jdbc:oracle:thin:@172.16.2.6:1521:dbname
jdbc-0.user=username
jdbc-0.password=username
jdbc-0.proxool.maximum-connection-count=20
jdbc-0.proxool.house-keeping-test-sql=SELECT SYSDATE FROM DUAL;
#DEBUG, INFO, WARN, ERROR, FATAL.
jdbc-0.proxool.statistics-log-level=ERROR
相关内容
赞助商链接