今天学习了“查”,查难度较大,学习了其中的一部分。
public String check(int m) throws Exception {
String a;
String sql = "SELECT * FROM daily where content like 'm'";
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/abc";
String username = "root";
String Password = "123123";
Connection connection = DriverManager.getConnection(url, username, Password);
java.sql.Statement stmt = connection.createStatement();
java.sql.ResultSet rs = stmt.executeQuery(sql);
a = rs.getString(m);
stmt.close();
rs.close();
return a;
}
标签:总结,jdbc,String,rs,mysql,stmt,学习,sql,2.25 From: https://www.cnblogs.com/clh628/p/17155568.html