1. 程式人生 > >Web專案配置資料來源——c3p0_xml方式

Web專案配置資料來源——c3p0_xml方式

<?xml version="1.0" encoding="UTF-8"?>
<c3p0-config>
<!-- 如果程式碼中的config名稱不是下面的某一個,就會根據預設配置進行查詢,如果也沒有預設配置,則按照預設值配置進行查詢 -->
<default-config>
<property name="jdbcUrl">jdbc:oracle:thin://@localhost:1521:XE</property>
<property name="driverClass">oracle.jdbc.driver.OracleDriver</property>
<property name="user">scott</property>
<property name="password">smq</property>
<property name="checkoutTimeout">30000</property>
<property name="initialPoolSize">10</property>
<property name="maxIdleTime">60</property>
<property name="maxPoolSize">100</property>
<property name="minPoolSize">10</property>

</default-config>
<!-- 配置生產環境的資料庫 -->
<named-config name="oracle_pro">
<property name="jdbcUrl">jdbc:oracle:thin://@localhost:1521:XE</property>
<property name="driverClass">oracle.jdbc.driver.OracleDriver</property>
<property name="user">scott</property>
<property name="password">smq</property>
<property name="checkoutTimeout">30000</property>
<property name="initialPoolSize">10</property>
<property name="maxIdleTime">30</property>
<property name="maxPoolSize">100</property>
<property name="minPoolSize">10</property>
</named-config>
<!-- 配置開發環境的資料庫 -->
<named-config name="oracle_dev">
<property name="jdbcUrl">jdbc:oracle:thin://@localhost:1521:XE</property>
<property name="driverClass">oracle.jdbc.driver.OracleDriver</property>
<property name="user">scott</property>
<property name="password">smq</property>
<property name="checkoutTimeout">30000</property>
<property name="initialPoolSize">10</property>
<property name="maxIdleTime">30</property>
<property name="maxPoolSize">100</property>
<property name="minPoolSize">10</property>
</named-config>
</c3p0-config>