SleepyEgg

Tech News, Deals, & Games

  • Increase font size
  • Default font size
  • Decrease font size
Home News Tech News useful tools from Apache Jakata Commons - dbcp

useful tools from Apache Jakata Commons - dbcp

E-mail Print PDF
dbcp is an implementation of Java connection pooling. This uses the common-pooling API. You can implement a generice Database class to wrap both JDBC connection pooling using dbcp and datasource looking using JNDI. Once this is done, you don't have to care about how it gets the connection from. example: for connection pooling using dbcp : http://cvs.apache.org/viewcvs.cgi/jakarta-commons/dbcp/doc/BasicDataSourceExample.java?rev=1.2&view=markup BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName("oracle.jdbc.driver.OracleDriver"); ds.setUsername("scott"); ds.setPassword("tiger"); ds.setUrl(connectURI); return ds; BasiceDataSource is a subclass of DataSource. So doesn't matter if it is from JNDI lookup or from dbcp, cache it. The only method you need to implement is getConnection(), which get connection from the datasource. Share Link:
Bookmark Google Yahoo MyWeb Del.icio.us Digg Facebook Myspace Reddit Ma.gnolia Technorati Stumble Upon
Comments (0)Add Comment

Write comment
You must be logged in to a comment. Please register if you do not have an account yet.

busy
 

Polls

Which is your favorite Game Console?
 

Login

               No account yet?