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
Interesting one, good catch Nino!!!
“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)”
Can you please clarify this? If there’s an issue in connecting I will fix it ASAP.
Regards,
Wallace
(BoneCP author)
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.
Sorry lost track of this thread!
Just for completeness sake, BoneCP can connect to any DB using either a username/pass combo or else just passes in any properties you want to the driver which should be accepted by HSQL.
Incidentally I always used to connect to HSQL via username = “sa” and no password.
@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
Hi Simone,
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
Hi Wallace,
how can I get in touch with you directly? Just give me a read-only svn access so I can submit a patch.
All the best,
Simo
Use wwadge at gmail.com.
Git repo is here: https://github.com/wwadge/bonecp
though I’ll accept plain text emails too
Hi Nino,
update you poms, BoneCP is available in the Maven Central Repo!!! Congrats Wallace for the release!
com.jolbox
bonecp
0.7.1-rc3
Cool !