I have a very large Java web application, close to a thousand classes and code. I use a database connection in almost every one of these classes. In Java JDBC I open the connection in a try
block and then simply do conn.close()
to close the connection.
Lately I have had many problems with "too many connection" errors. This seems to be a problem with the connection not closing properly. I learned the best way to do this is in a finally
block to close the connection. However I have not done this through the life of this application and it would take me hours and days to go through every one of these classes and try
blocks.
Is there any way in Eclipse to batch-fix every class and add a finally
block to each try
block so I can properly close the connection?