1 | while (rs.next() ) { |
2 | int a = rs.getInt(1); |
3 | String str = rs.getString(2); |
4 | System.out.println("key = " + a); |
5 | System.out.println("str = " + str); } |
6 | //close the query execution and the database |
7 | connection before exiting |
8 | stmt.close(); |
9 | conn.close(); |
10 | } |
11 | //catch any exception and print it to the |
12 | system output |
13 | catch ( Exception e) { |
14 | System.out.println (e.getMessage() ); |
15 | e.printStackTrace(); |
16 | } |
17 | } // End main |
18 | } // End class Select |