There's no way to check statically. However you can set up to run for a while, monitor the network socket connections and if they begin to build up, take a profile snapshot and backtrace to see where the allocations were being made. Unfortunately, one of the best ways to leak connections is to not intercept exceptions and close the connection on the way back up the stack. Which is why I like the Spring Framework. It handles stuff like that.
Also, most of the ORM implementations afford some protection (or at least traceability) on things like this.
But that's small consolation when you inherit a lot of ugly old code done with brute-force
JDBC.
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.