连接池的配置

5.5.4 的一个 bug, 不能在 appname.xml 中如下配置
---------------------------------
<Context path="/a" reloadable="true">
    <Resource name="jdbc/a" scope="Shareable" type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/a">
        <parameter>
            <name>factory</name>
            <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
        </parameter>

        <!-- DBCP database connection settings -->
        <parameter>
            <name>url</name>
            <value>jdbc:postgresql://192.168.4.41/a</value>
        </parameter>
        <parameter>
            <name>driverClassName</name><value>org.postgresql.Driver</value>
        </parameter>
        <parameter>
            <name>username</name>
            <value>postgres</value>
        </parameter>
        <parameter>
            <name>password</name>
            <value>218pgchd</value>
        </parameter>

        <!-- DBCP connection pooling options -->
        <parameter>
            <name>maxWait</name>
            <value>2</value>
        </parameter>
        <parameter>
            <name>maxIdle</name>
            <value>2</value>
        </parameter>
        <parameter>
            <name>maxActive</name>
            <value>2</value>
        </parameter>
    </ResourceParams>
</Context>

----------------------------------------

而是如下配置:
<Context path="/a" reloadable="true" docBase="/home/cron/java/a" workDir="/home/cron/java/a/work">
    <Resource name="jdbc/a" scope="Shareable" type="javax.sql.DataSource" auth="Container" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://127.0.0.1:5432/a" username="postgres" password="" factory="org.apache.commons.dbcp.BasicDataSourceFactory"/></Context>

你可能感兴趣的:(apache,sql,xml,jdbc,PostgreSQL)