So I'm trying to switch from using a normal ResultSet to a CachedRowSet so i can disconnect. My queries executed before i switched from RS to CRS
my current code is:
the problem i'm having now is crs isn't storing any of the data. When i put it through the debugger and step line by line through the code, resultSet has all the correct data, however crs does not store the data even after the .populate statement....Code:public static CachedRowSet DBQuery(String SQL){ CachedRowSet crs = null; Connection conn = null; ResultSet resultSet = null; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection(DBPath,DBUsername,DBPassword); PreparedStatement preparedStatement = conn.prepareStatement(SQL); resultSet = preparedStatement.executeQuery(); crs = new CachedRowSetImpl(); crs.populate(resultSet); }catch(Exception e) { JOptionPane.showMessageDialog(null, e); } return crs; }
any idea's would be great!
thanks
edit, additionally i'm using the latest JDK, and mysql connector/j 5.1.13


Reply With Quote