So that in other class, I can invoke this method to get resultset:
But this does not work, I get SQLException if I invoke next() method on the returned resultset.
I searched the reason, and i think this may be the reason:
Or you can look at CachedRowSet, because ResultSet object is bound with the Statement object. However, CacheRowset is independent and made for passing across layers.
A CachedRowSet classa disconnected rowset that caches its data in memory; not suitable for very large data sets, but an ideal way to provide thin Java clients, such as a Personal Digital Assistant (PDA) or Network Computer (NC), with tabular data
Could somebody explain more to me?
Thanks a lot,
posted 5 years ago
A ResultSet can certainly be returned from a method, but if you close the connection, then all associated resources (ResultSets, Statements, etc.) will be closed as well.