...
Connection con = null;
try {
con = DriverManager.getConnection(url, uid, pw);
Statement stmt = con.createStatement();
ResultSet rst = stmt.executeQuery("SELECT ename,salary FROM Emp");
System.out.println("Employee Name,Salary");
while (rst.next()) {
System.out.println(rst.getString("ename")+","+rst.getDouble("salary"));
}
con.close();
} catch (SQLException ex) {
System.err.println("SQLException: " + ex); }
}
}