Tomcat 配置 Oracle Database Connection Pool (DBCP)
1 要保證oracle的相關(guān)的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 修改應(yīng)用的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 代碼實(shí)現(xiàn)
posted on 2011-06-14 09:34 amenglai 閱讀(219) 評(píng)論(0) 編輯 收藏