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();
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 838
Posting Genius
Offline 6,756 posts
since May 2007