Tuesday, November 29, 2011

How do I check in my code whether a maximum limit of database connections have been reached?

Use DatabaseMetaData.getMaxConnections() and compare to the number of connections currently open. Note that a return value of zero can mean unlimited or, unfortunately, unknown. Of course, driverManager.getConnection() will throw an exception if a Connection can not be obtained.
Category:JDBC Interview Questions

No comments:

Post a Comment