Reputation: 17
What are side effects when iam return a Resulset(java.sql.ResultSet) in the method using java.
Upvotes: 0
Views: 559
Reputation: 262534
It leaks the ResultSet out of the method. This means that it is up to the caller to clean up the Connection. Only do this if the ResultSet contains too much data to simply copy it into memory (and then close it within the method), and if the caller can be expected to manage database connections (for example, when the Connection was passed into the method as a parameter as well).
Upvotes: 2