These last days I’ve been working on a Rest application which provides a generic interface to a database. So the idea are to provide a “REST” driver that can look into any given database. Since I needed look into any given table I could’nt use my ordinary stack with guice / warp persist and JPA. But had to create my own jdbc template (like spring jdbc template). Doing db stuff one needs a connection pool and since C3P0 are somewhat dead (haven’t had a release in ages), I decided to go with Apache DBCP.
Im having one problem though if I use PoolableDatasource I get the dreaded “java.net.BindException: Address already in use: connect”. If I manage the pool via the ObjectPool myself, it works like a charm. Not what I’ve hoped for.
Im wondering if it would be better (simpler) if I i used http://www.jolbox.com/ (Bone CP). I guess some one should make something like the Spring jdbc template for guice.
I’ve done some more testing and found out following things:
- C3P0 are simple to setup, you can always owervrite defaults by property files or xml files
- C3P0 are slower than Apache DBCP
- Apache DBCP, pooled connection does not work or I am using it wrong
- Bone CP,
cannot connect to a jdbc uri with embedde password, user / password needs to be setup explicitly (which gives problems when using in memory hsql, no password / user)
For now I think i will be sticking to C3P0 since i gives the most clean implentation, although a little slower than the rest (we are talking miliseconds, for 150 concurrent users).
EDIT I need to revisit Bone CP since it has been updated and are now available in central repo