posted 3 weeks ago
Actually, barring termination of the JVM, the connection will close when it times out on the database server. That is, it's not the "Connection" that times out, it's the (network) connection.
That has been a particular problem for webapp servers keeping a Connection Pool, since connections could expire while in the pool. So various mechanisms exist to check for a dead connection and, if necessary, replace it with a new one.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.