You have executed a new query here through your statement so the result set you obtained with that statement is no longer valid and you cannot retrieve field values from it.
stmt.execute( "DROP TABLE " + rs.getString(1));
Create a separate statement object to make your "DROP TABLE" calls with.
PreparedStatement updateStmt = conn.prepareStatement("DROP TABLE ?");
stmt = conn.createStatement();
rs = stmt.executeQuery( "SHOW TABLES");
while (rs.next()) {
updateStmt.setString(1, rs.getString(1));
updateStmt.executeUpdate();
}
updateStmt.close();
stmt.close();
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847