This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I am getting the following exception while using org.apache.commons.dbcp.ConnectionFactory for my Swing base Java application.
Database Error: Cannot get a connection, pool exhausted
Unexpected error has occured, the request can't be processed.
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
This error indicates that you are not closing connections properly and thus, it exceeds the number of available connections from the connection pool. It is a good practice to close result set, statement and connections properly to avoid this exception.
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
Thanks for the reply, i had same problem then i checked my code where am calling one method to another class method there again getting connection from datasource and its increasing the connections which i have specified in the configuration file, then i realized to increase the connections to as many times am using that didnt solved my problem again giving same error.
Then thought creating/ getting connection from datasource in main method (stating of the program) and pass the connection object to other called methods then it solved my problem and i have tested stress test like generating extracts about 1k with out any error.
You can check your code it will be good to open connection for thread and use that connection entire that thread and close at the end.