Question

I'm reading about c3p0 and dbcp for handling jdbc connections and heard alot of problems and people saying dbcp is dead but c3p0 can't do jdbc4 and so on. But I don't know if these posts are out of date.

Now I hit on BoneCP which explains how broken connections are handled here. Connections are wrapped and BoneCP does some prechecking of exceptions before they get passed to the application. If something is wrong with the connection BoneCP removes it from the pool.

1.) Do all these pools have that kind of connection handling?

2.) This question gets asked over and over again, but I couldn't find any answer from 2011. What one shall I use for a new application, that will be maintained for the next 10 years, if not more.

Was it helpful?

Solution

1.) I don't know about dbcp but with regards to C3P0 this functionality does exist in the C3P0PooledConnection class (look in the invoke method, the exception is caught and handled, if you want more details on the exact handling I can add them). I also needed to know if it contained it to drop testOnCheckin/Checkout and I verified it contains this behaviour.

2.) Really hard to say, since on the one hand C3P0 is widely used in many production sites and the maintainer has resumed active development but on the other hand BoneCP seems to have some very interesting design principles (pool sharding for examples) and some flattering benchmarks. Since you usually have a pretty good indirection from your connection pool library (mostly the dependency is contained to a config file or two) I can suggest to start with one and once you have a production with actual data try to optimize it and compare it with another library (also optimized of course). It very well may be that either library you choose will be sufficient for your needs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top