以jdni方式使用proxool的配置方法

我在tomcat6.0中调试通过,在相应的上下文配置文件中,进行如下配置即可。
<Context path= "/PoolTest" reloadable= "false" docBase= "/PoolTest"   > 
	<Resource   
		name= "jdbc/wallimnDataSource"  
		auth= "Container"  
		type= "javax.sql.DataSource"  
		factory= "org.logicalcobwebs.proxool.ProxoolDataSource"  
		proxool.alias= "DefaultDS"  
		user= "HR"  
		password= "HR"  
		proxool.driver-url= "jdbc:oracle:thin:@127.0.0.1:1521:ORADB"  
		proxool.driver-class= "oracle.jdbc.driver.OracleDriver"
		proxool.house-keeping-sleep-time="400000"
		proxool.maximum-new-connections="20"
		proxool.prototype-count="3"
		proxool.maximum-connection-count="40"
		proxool.minimum-connection-count="5"
		proxool.house-keeping-test-sql="select 1 from dual"
		proxool.test-before-use="true"
		proxool.maximum-connection-lifetime="18000000"
		proxool.simultaneous-build-throttle="5"
		proxool.recently-started-threshold="40000"
		proxool.overload-without-refusal-lifetime="50000"
		proxool.maximum-active-time="60000"
		proxool.verbose="true"
		proxool.trace="true"
		proxool.fatal-sql-exception="Fatalerror"
	/>
</Context>


修改工程的web.xml文件,加入:
  <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/wallimnDataSource</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>  
  </resource-ref>


如果使用jstl,还要在web.xml文件中加入:
	<context-param>
		<param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>
		<param-value>jdbc/wallimnDataSource</param-value>
	</context-param>


获取连接的java代码:
    Context ctx = new InitialContext();
    DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/wallimnDataSource");
    Connection conn = ds.getConnection();

你可能感兴趣的:(java,sql,xml,Web,jdbc)