< Resource auth ="Container" delegateProperties ="foo=bar" factory ="org.logicalcobwebs.proxool.ProxoolDataSource" name ="/jdbc/mydatasource" user ="user" password ="password" proxool.alias ="proxool_testdb" proxool.driver-class ="oracle.jdbc.driver.OracleDriver" proxool.driver-url ="jdbc:oracle:thin: :1521:pub" proxool.maximum-connection-count ="5" proxool.maximum-active-time ="10000" proxool.house-keeping-sleep-time ="180000" proxool.house-keeping-test-sql ="Select Sysdate From dual" proxool.prototype-count ="2" type ="javax.sql.DataSource" />
这样,Jndi就配置完成了...... 然后在程序里面可以这么得到DataSource和Connection: try { Context ctx = new InitialContext(); DataSource dataSource = (DataSource) ctx.lookup( " java:comp/env/jdbc/mydatasource " ); Connection conn = dataSource.getConnection(); } catch (Exception e) { e.printStackTrace(); }
这样就完成了...