标签:出现 api rop use rest c中 statement 注入 container
SELECT * FROM USERS WHERE username= ‘user1‘ AND password=‘0000‘; DROP TABLE USERS;
SELECT * FROM USERS WHERE username= ‘user1‘ AND password=‘0000‘ OR 0=0;
使用预编译的sql语句,如下:
String sql = ‘SELECT * FROM USERS WHERE username=? AND password=?‘;
PreparedStatement pst = conn.prepareStatement(sql);
pst.setString(1,user.getUserName());
pst.setString(2,user.getPassWord());
为每个?
赋值,在JDBC中对应的就是PreparedStatement,可参考JDBC
标签:出现 api rop use rest c中 statement 注入 container
原文地址:https://www.cnblogs.com/myibu/p/13185308.html