user918304
user918304

Reputation: 2165

Connection pool to MySQL server?

I find many resources about how to create the connection pool with JNDI to the MySQL Server; however, I want to know if I just want to use a standalone Java class to connect the MySQL Server and with a connection pool mechanism (without the help of app server), how could I figure it out?

Upvotes: 0

Views: 921

Answers (2)

user330315
user330315

Reputation:

Tomcat's connection pool is a separate component named DBCP. You can download it and use it without Tomcat:

http://commons.apache.org/dbcp/

Another very popular connection pool is C3P0 (which I believe is used by Hibernate internally). It can be downloaded here:

http://sourceforge.net/projects/c3p0/

Upvotes: 1

Churk
Churk

Reputation: 4637

If you are not using an app server to handle your connection pool, the other option are implement one yourself, where you have to pay attention to which connection is dead and re-init, hands out free connections upon request, etc... Here is a little light reading on it: http://java.sun.com/developer/onlineTraining/Programming/JDCBook/conpool.html

Other way is look for connection pool java packages such as this one: http://www.snaq.net/java/DBPool/, this is the first package I found googling, so I have no idea if it is good or not, just an example.

Upvotes: 1

Related Questions