proxool池设置

<?xml version="1.0" encoding="UTF-8"?>
<something-else-entirely>
    <proxool>
        <alias>proxool123</alias> <!--数据源的别名-->
        <driver-url>jdbc:oracle:thin:@192.168.0.12:1521:cenbow</driver-url><!--url连接串-->
        <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> <!--驱动类-->
        <driver-properties>
            <property name="user" value="devpro" /> <!--用户名-->
            <property name="password" value="123" /><!--密码-->
        </driver-properties>
		<!--最大连接数(默认5个),超过了这个连接数,再有请求时,就排在队列中等候,最大的等待请求数由maximum-new-connections决定 -->
        <maximum-connection-count>100</maximum-connection-count>
		<!--最小连接数(默认2个)-->
        <minimum-connection-count>10</minimum-connection-count>
		<!--proxool自动侦察各个连接状态的时间间隔(毫秒),侦察到空闲的连接就马上回收,超时的销毁 默认30秒-->
        <house-keeping-sleep-time>90000</house-keeping-sleep-time>
		<!--没有空闲连接可以分配而在队列中等候的最大请求数,超过这个请求数的用户连接就不会被接受-->
        <maximum-new-connections>10</maximum-new-connections>
		<!--最少保持的空闲连接数(默认2个)-->
        <prototype-count>5</prototype-count>
		<!--在使用之前测试-->
        <test-before-use>true</test-before-use>
		<!--用于保持连接的测试语句 -->
        <house-keeping-test-sql>select sysdate from dual</house-keeping-test-sql>
    </proxool>
</something-else-entirely>

applicationContext.xml
<!-- Hibernate SessionFactory -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <!--<property name="dataSource" ref="dataSource"/>-->
        <property name="configLocation" value="classpath:hibernate.cfg.xml"/>
        <property name="hibernateProperties">
            <value>
                hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
                hibernate.query.substitutions=true 'Y', false 'N'
                hibernate.cache.use_second_level_cache=true
                hibernate.show_sql=true
                hibernate.format_sql=true
                hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
                hibernate.hbm2ddl.auto=none
                hibernate.jdbc.batch_size=20
                connection.provider_class=org.hibernate.connection.ProxoolConnectionProvider
                hibernate.proxool.xml=proxool.xml
                hibernate.proxool.pool_alias= proxool123 <!--数据源的别名-->
                hibernate.proxool.existing_pool=true
                hibernate.connection.autocommit=true
            </value>
            <!-- 
                   hibernate.connection.autocommit此值设为 false,当 hibernate 开始被调用时,就会初始化 proxool,进行数据库连接等操作
             -->
            <!-- Turn batching off for better error messages under PostgreSQL -->
            <!-- hibernate.jdbc.batch_size=0 -->
        </property>
    </bean>

web.xml
<servlet>
        <servlet-name>ServletConfigurator </servlet-name>
        <servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class>
        <init-param>
            <param-name>xmlFile</param-name>
            <param-value>/WEB-INF/classes/proxool.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    
    <servlet>
        <servlet-name>proxooladmin</servlet-name>
        <servlet-class>org.logicalcobwebs.proxool.admin.servlet.AdminServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>proxooladmin</servlet-name>
        <url-pattern>/proxooladmin</url-pattern>
    </servlet-mapping>

你可能感兴趣的:(oracle,Hibernate,xml,jdbc,cache)