Statement stmt2 = myConnection.createStatement( );
ResultSet results = stmt2.executeQuery("SELECT id, name " +
" FROM city");
while(results.next( ))
{
int ID = results.getInt(“id"); // Get column by name
String Name = results.getString(2); // Got column by number
System.out.println(ID + ":" + Name);
}
results.close( );