tomcat5.0下配置连接池

tomcat5.0下配置连接池

\tomcat\conf\Catalina\localhost目录下建立一个配置文件:

 文件的名称为:sync4j.xml,需要注意的是sync4j是应用的名称

内容如下:

<?xml version='1.0' encoding='UTF-8'?>

<Context path="/sync4j" docBase="sync4j"  debug="9" privileged="true" verbosity="4">

<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_sync4j_log." suffix=".txt" timestamp="true" />

<Resource name="jdbc/myoracle" auth="Container" type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/myoracle">

<parameter>

<name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>

</parameter>

<parameter>

<name>driverClassName</name>

<value>oracle.jdbc.driver.OracleDriver</value>

</parameter>

<parameter>

<name>url</name>

<value>jdbc:oracle:thin:@192.168.5.8:1521:ics</value>

</parameter>

<parameter>

<name>username</name>

<value>zhoup</value>

</parameter>

<parameter>

<name>password</name>

<value>zhoup</value>

</parameter>

<parameter>

<name>maxActive</name>

<value>20</value>

</parameter>

<parameter>

<name>maxIdle</name>

<value>10</value>

</parameter>

<parameter>

<name>maxWait</name>

<value>10000</value>

</parameter>

</ResourceParams>

</Context>

 

 

C:\Tomcat 5.0\common\lib目录下拷入class12.jar

class12.jar是oracle的jdbc的驱动程序不包

 

web.xml中修改代码

<description>oralceDB</description>

<resource-ref>

<description>DB Connection</description>

<res-ref-name>jdbc/myoracle</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

 

你可能感兴趣的:(tomcat)