mysql-JDBC连接MySQL插入数据问题
程序员文章站
2024-02-15 13:39:28
...
mysqljdbc连接插入数据
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql", "root", "123456");
PreparedStatement sqlStmt =null;
String Email=request.getParameter("Email");
String Password=request.getParameter("Password");
String RePassword=request.getParameter("RePassword");
int power=1;
String sql = "INSERT INTO user_type(user_name,password,power) VALUES (?,?,?)";
sqlStmt=conn.prepareStatement(sql);
sqlStmt.setString(1,"Email") ;
sqlStmt.setString(2,"Password") ;
sqlStmt.setInt(3,'1') ;
sqlStmt.executeUpdate(sql);
out.print("alert('插入成功!');window.location.href='contact.html'");
上一篇: 还是正则匹配的有关问题,求前辈指导.