import java.sql.*; public class Eric { static { try { System.out.println("Please wait...initializing..."); Class.forName("com.mysql.jdbc.Driver").newInstance(); } catch (Exception e) { e.printStackTrace(); } } public static void main(String args[]) { Statement stmt = null; Connection targetCon = null; try { targetCon = DriverManager.getConnection("jdbc:mysql://mrhat/test"); System.out.println("Connected..."); } catch (SQLException e) { System.out.println("sqlstate = " + e.getSQLState() ); e.printStackTrace(); } try { stmt = targetCon.createStatement(); System.out.println("Executing query..."); ResultSet rs = stmt.executeQuery("select col1 from test.erictest"); while (rs.next() ) { int count = rs.getInt(1); System.out.println("count = " + count ); } } catch (Exception e) { e.printStackTrace(); } } }