After closing a database connection in java, can I reopen it? Or do I need to do DriverManager.getConnection() again?
After closing a database connection in java, can I reopen it? Or do I
Share
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.
I’m not 100% sure that you need to call
DriverManager.getConnection()but what’s the harm? You already closed the connection, just grab a new one when you need it. The garbage collector worries about that closed connection after you discard it.