while (rs.next() ) { |
int a = rs.getInt(1); |
String str = rs.getString(2); |
System.out.println("key = " + a); |
System.out.println("str = " + str); } |
//close the query execution and the database |
connection before exiting |
stmt.close(); |
conn.close(); |
} |
//catch any exception and print it to the |
system output |
catch ( Exception e) { |
System.out.println (e.getMessage() ); |
e.printStackTrace(); |
} |
} // End main |
} // End class Select |