public static void Main (string[] args) {
String usname= "root";
String pwd = "000000";
String driver= "Com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/zslm?user=root&password=000000"; ZSLM is the database name, root is the user password//is the password
String sql = "SELECT * from module";
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName (driver); Load Driver
conn = drivermanager.getconnection (URL); Get Connected
stmt = Conn.createstatement ();
rs = stmt.executequery (SQL);
if (Rs!=null) {
while (Rs.next ()) {
System.out.println (rs.getstring (1));
System.out.println (rs.getstring (2));
System.out.println (Rs.getdate (3));
System.out.println (Rs.getstring (4));
System.out.println (Rs.getstring (5));
System.out.println (rs.getstring (6));
System.out.println (rs.getstring (7));
}
}else{
System.out.println ("RS is null");
}
Rs.close ();
Stmt.close ();
Rs.close ();
} catch (ClassNotFoundException e) {
E.printstacktrace ();
}catch (SQLException e) {
E.printstacktrace ();
}