import java.sql.*; public class Baas1{ public static void main(String[] arg) throws Exception{ Connection cn=DriverManager.getConnection( "jdbc:mysql://localhost/mysql?user=root&password=" ); Statement st=cn.createStatement(); ResultSet rs=st.executeQuery("SELECT User, Host FROM user"); while(rs.next()){ System.out.println( rs.getString("User")+" "+rs.getString("Host")); } } }