0

I have a servlet which connects to Oracle DB using JDBC (ojdbc6.jar) and BoneCP. I now need to port my BoneCP-using code to something which will work in WebLogic out-of-the-box, without having BoneCP in the package.

What would be the recommended approach? What WebLogic feature I can use, specifically to get an equivalent of BoneCP's:

  • Performance
  • Ability to log failed SQL statements
  • Auto-resume from lost DB connection

Thanks in advance.

Wanna Know All
  • 681
  • 2
  • 8
  • 18

1 Answers1

0

The best approach would be to create a standard Oracle JDBC connection pool pointing to your database. Tune it according to your necessities (number of connections, etc.). Next you would need to refactor out of your code any explicit reference to your former connection pool implementation. If you have been working with java.sql.* interfaces in your code, there should be few to no references at all.

Once all that is refactorized, you will have only a bit of code (or config file) telling your app to recover something implementing javax.sql.DataSource from a given JNDI name and getting Connections out of it. The rest should be the same - just do whatever you need and close your ResultSets, Statements and Connections as you must have been doing until now.

About your questions, you will find extensive information on how to monitor your connection pool, and its fail recovery policies, here (depending on your app server version, I paste here the one I have used):

http://docs.oracle.com/cd/E15051_01/wls/docs103/jdbc_admin/jdbc_datasources.html

About performance, I have no accurate data nor benchmarks comparing both implementations; for your tranquility, I would say you that I have never found a database performance problem in the connection pool implementation - this does not mean that it cannot exist, but it is the last place I would look for it ;)

Jorge_B
  • 9,712
  • 2
  • 17
  • 22
  • Thank you. One question though - what is the actual implementation behind WebLogic's data sources pool? Is it Oracle Universal Connection Pool (UCP)? Because if so, people [here](http://stackoverflow.com/a/4444922/2523948) clearly say that *it's not recommended*. – Wanna Know All May 19 '14 at 08:55
  • AFAIK, weblogic implementation of connection pooling, etc., falls into weblogic.jdbc.common.internal.* since 8.1 to 10.3 (I have not tried more recent versions, I am sorry) so I guess its code comes from the BEA times. I don't know if the code has been merged since then, but UCP seems a different product to me – Jorge_B May 19 '14 at 09:37