import java.sql.*; public class Pallibaas2{ public static void main(String argumendid[]) throws Exception{ Class.forName("org.gjt.mm.mysql.Driver"); Connection cn=DriverManager.getConnection( "jdbc:mysql:/localhost/pood", "", ""); Statement st=cn.createStatement(); String lause="SELECT kogus FROM pallid;"; ResultSet rs=st.executeQuery(lause); rs.next(); System.out.println("Baasis on "+rs.getInt("kogus")+" palli"); cn.close(); } }