Guice JDBC and Pools

12032010

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

Yeah, afair when it has problems when connecting to HSQL where theres no user / password needed to connect. Give it a try and you’ll see. I was really interested in using Bone CP, because it has the simplicity that I was looking for.

@Wallace: I’d like to integrate BoneCP as well in the MyBatis-Guice (I’m the maintainer) subproject, but I didn’t find any reference on how to include it using Apache Maven… any hint?
In the case you still haven’t submitted to Maven Central Repo I can help you, having experienced it. Just let me know

Sorry didn’t get notifications for your post. BoneCP is built via maven but it’s not submitted to Maven Central yet (you need to add the site to your repositories list) — I’d like to take your offer for info re maven central submission 🙂