Java and Database Connectivity
|
Using resources: Why be tidy?
-
You don't need to be tidy
-
Doesn't matter for small or non-critical programs
-
Connections will be reclaimed by the garbage collector
if you don't expicitly close them
-
But
-
You don't know when garbage collection will happen
-
It might happen before you've finished with your result set
-
It might not happen for a long time, and you might be
left with many open sessions which will overload your
database server