Tomcat 配置 Oracle Database Connection Pool (DBCP)

Tomcat 配置 Oracle Database Connection Pool (DBCP)

 

1 要保证oracle的相关的jar放在 $CATALINA_HOME/common/lib目录下。

2 修改server.xml文件

                                   <Context path="/hrms" docBase="hrms" debug="2" reloadable="true" crossContext="true">

               

                                                                                                <Resource name="jdbc/hrmsora" auth="Container"

              type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"

              url="jdbc:oracle:thin:@127.0.0.1:1522:orcl"

              username="puzzle16" password="puzzle16" maxActive="20" maxIdle="10"

              maxWait="-1"/>

                                                </Context>

3 修改应用的web.xml文件

<resource-ref>

 <description>DB Connection</description>

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

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

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

</resource-ref>

 

4 代码实现

你可能感兴趣的:(Tomcat 配置 Oracle Database Connection Pool (DBCP))