Use RowSet as a return value of the ResultSet type

xiaoxiao2021-03-06  170

ResultSet is a return value, it is difficult to determine when it will be closed.

ResultSet executeQuery (String sql) {CachedRowSet rowSet = new CachedRowSet (); ResultSet rs = null; Connection conn = null; Statement stmt = null; try {// database operations rowSet.populate (rs);} cacth (SQLException e) { } Finally {// Turn off all database resources, except RowSet} Return RowSet;}

转载请注明原文地址:https://www.9cbs.com/read-128143.html

New Post(0)