Reopen database connection in Java

java, jdbc

Solution

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.

Problem

After closing a database connection in java, can I reopen it? Or do I need to do `DriverManager.getConnection()` again?

Original source