If I create a MySQL Connection in my java program, and the program exits from main method, what happens to this MySQL Connection?
public static void main(String args[])
{
Connection conn = getConnection(...);
return;
}
Does this connection get closed automatically?
Or does the connection stays alive until it times out?
The operating system will either close or reset all open TCP connections of a process when the process exits, depending on the platform. In either event the database server will notice immediately. No timeout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With