Based on the encouragement of other posters, I attempted to eliminate DBCP and use the MySQL JDBC driver directly (Connector/J 5.0.4). I was unable to do so.
Based on the encouragement of other posters, I attempted to eliminate DBCP and use the MySQL JDBC driver directly (Connector/J 5.0.4). I was unable to do so. It appears that while the driver does provide a foundation for pooling, it does not provide the most important thing: an actual pool (the source code came in handy for this).
It is left up to the application server to provide this part. I took another look at the JDBC 3.0 documentation (I have a printed copy of something labeled "Chapter 11 Connection Pooling", not sure exactly where it came from) and I can see that the MySQL driver is following the JDBC doc. When I look at DBCP, this decision starts to make sense.
Good pool management provides many options. For example, when do you purge unused connection? Which connections do you purge?
Is there a hard or soft limit on the max number of connections in the pool? Should you test a connection for "liveness" before giving it to a caller? Etc.
Summary: if you're doing a standalone Java application, you need to use a connection pooling library. Connection pooling libraries are still relevant.
DBCP has serious flaws. I don't think it's appropriate for a production application, especially when so many drivers support pooling in their DataSource natively. The straw that broke the camel's back, in my case, was when I found that the entire pool was locked the whole time a new connection attempt is made to the database.So, if something happens to your database that results in slow connections or timeouts, other threads are blocked when they try to return a connection to the pool—even though they are done using a database.
Pools are meant to improve performance, not degrade it. DBCP is naive, complicated, and outdated.
– jdigital Jan 29 '09 at 3:57 It depends on the driver. With Oracle and PostgresQL, it was a simple configuration change--the code was already working with a (DBCP) DataSource. I don't have experience with MySQL drivers.
– erickson Jan 29 '09 at 4:00 1 I would agree that DBCP is broken. We switched to C3PO and it worked like a dream – j pimmel Jan 29 '09 at 4:56 1 Same question would apply to C3PO - is it still relevant? – jdigital Jan 29 '09 at 17:00 1 We've been using DBCP together with Spring for about 4 years with no issues - maybe we've been lucky!
– Fortyrunner Jan 29 '097 at 5:27.
I prefer using dbcp or c3p0 because they are vendor neutral. I found out, at least with mysql or oracle, that whenever I try to do something with the jdbc client that is not standard sql I have to introduce compile-time dependency on the vendor's classes. See, for example, a very annoying example here.
I am not sure about mysql, but oracle uses their specific, non-standard classes for connection pooling.
The thread - you provided - is not relevant, I am afraid. – Adeel Ansari Jan 29 '09 at 2:59 I know. I referred to it to illustrate what I meant regarding compile dependencies.
– Yoni Jan 29 '09 at 3:58.
I'm not a big believer in replacing infrastructure unless there's already a performance or functionality gap that it can't fill, even if there are newer or fancier alternatives around.
DBCP works, but if I can get the same features from the JDBC driver, I'd just as soon simplify things. I also wouldn't mind removing some of the code we've added to "fix" DBCP exception handling. – jdigital Jan 29 '09 at 2:32 c3p0 comes with – Adeel Ansari Jan 29 '09 at 3:08.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.