commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Lars Torunski)
Subject [DBCP] Deadlocks in DriverManager.getConnection
Date Thu, 11 Nov 2004 07:22:51 GMT

the Apache commons dbcp (1.2.1) is using DriverManager.getConnection to 
get database connections. We had a lot of deadlock situations using this 
method with and without using connection pooling libraries. According to this method is 
really deadlock prone:

Q. Why should I not use DriverManager.getConnection?

A. DriverManager.getConnection can cause a deadlock. In the server, all 
DriverManager calls are class-synchronized including many frequent calls 
that all drivers make, and JDBC drivers do a lot of synchronization 
internally. One long-waiting call can stop all JDBC work in the whole 
JVM and cause deadlocks. Also, you should not reregister the driver 
repeatedly. Regardless of the DBMS state, the one driver that is 
initially loaded at startup will always work.

After some help from the BEA Support Team we are using Driver.connect 
now and we havn't run into any deadlock situation again.

I reviewed serveral mailing list but I didn't find any information about 
this. OK, a lot of people will increase the pool size if they run into a 
similar situation. But this doesn't solve the real problem of 

After I spoke with Steve Waldman (maintainer of c3p0), he fixed the 
problem in c3p0-0.8.5-pre7 ( ).

Does have anybody experiences with this class and method?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message