import java.sql.*;
...... try{
Connection conn = DriverManager.getConnection ("jdbc:mysql://localhost/?user=<>&password=<>");
Statement st = conn.createStatement(); RusultSet rs = st.executeQuery("select * from
where <条件>"); eg."select * from manager where id= '"+id+"' and password='"+password+"'" //id,password为参数 eg.类ResultSet 方法getString("")或 getString(n)//第n个属性 rs.close();st.close();} catch (SQLException e){ e.printStackTrace(); }
try{
Connection conn = DriverManager.getConnection ("jdbc:mysql://localhost/?user=<>&password=<>");
PrepareStatement prest = con.prepareStatement("insert into
/*Select语句,executeQuery()方法 *Delete、Update、Insert语句,executeUpdate()方法 Create,Drop语句,execute()或executeUpdate()方法/
} catch (SQLException e){ e.printStackTrace(); }