I am using MYSQL database and basic JDBC connection pool for connect to the database. application is deployed in tomcat server. After few operations, database connection getting null.
could any one please let me know the reason for that ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This can happen for a few different reasons:
close()on yourConnectionresources when you’re done with them. This can cause your connection pool to be exhausted after all theConnections are handed out and not closed.close()on yourConnectionresources more than once. Closing aConnectionreturns it to the pool so another thread can grab it. If you callclose()a second time, you’ve now closed it for the other thread.Connectioninstance tonullsomewhere.Connectionresource open and idle for too long and it’s timing out on you. If your code has some long running operation between queries, consider closing theConnectionand getting a new one between queries.