I have a Java web app running on Tomcat 7 that is using JDBC to connect to an Oracle 11g database. The app contains a JSP that uses JQuery to make an Ajax request (using the .post function) to a servlet that inserts data into the database. When the system is under even a light load, I start seeing idle connections in the database. I observe them by checking v$session in SQL Developer. When we ran a performance test, it maxed out the database server with 150 connections in about 2 minutes. I have been over my code many times, and I always close all ResultSets, Statements, and Connections in a finally block. The problem arises when the JSP submits multiple Ajax requests simultaneously, which made me think it might be a multithreading issue, but again, I have been over my code, and there is no data being shared across threads. The code that gets the connection from the data source and closes the connections is in an abstract base class that all the DAO classes inherit from. Does anyone have any idea what might cause this? Since there are many classes involved, I wasn’t sure what source code to post; let me know if you want to see any. Thanks for your help.
Share
Try setting maxWait to 10000 and watch for timeouts. That would indicate that some components of your web application are not closing database connections.
Also, try limiting maxActive to, say, 15 and see how that affects both your application and the number of simultaneously opened connections in Oracle.