在jdbc中,有三种方式执行sql,分别是使用Statement(sql拼接),PreparedStatement(预编译),还有一种CallableStatement(存储过程),
//校验信息集有效性 使用execute回调方法,防止sql注入
String ProcSql= "call xxxx(?,'01','01')" ;
this.jdbcTemplate.execute(ProcSql,
new PreparedStatementCallback(){
public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
ps.setString(1, A00);//这里的参数对应?
ps.addBatch();
return ps.executeBatch();
}
});
如果是拼接表名的话