package baas1; import java.sql.*; public class Koerteloetelu { public static void main(String[] args) throws Exception{ Connection cn=DriverManager.getConnection("jdbc:mysql://localhost/test"); ResultSet rs=cn.createStatement().executeQuery( "SELECT id, koeranimi, synniaasta FROM koerad"); while(rs.next()){ System.out.println(rs.getString("koeranimi")); // System.out.println(rs.getString("id")); } cn.close(); } }