package com.www;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import com.mysql.jdbc.Driver;
public class Code {
public static void main(String[] args) {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/login", "", "");
Statement pst = con.createStatement();
String sql = "select * from user01;";
ResultSet rs = pst.executeQuery(sql);
while(rs.next()){
System.out.println(rs.getInt(1)+" "+rs.getInt(2));
}
rs.close();
pst.close();
con.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
“没有利用价值的人是很受冷遇的。”
——渡边淳一 《失乐园》