想问下:
java里面:
1、
String cust_no="123456";
StringBuffer qry = new StringBuffer();
qry.append(" SELECT * ");
qry.append(" FROM TORDERDETAIL ");
qry.append(" where CUST_NO =? ");
pStmt = conn.prepareStatement(qry.toString());
pStmt.setString(1,cust_no);
rs = pStmt.executeQuery();
和
2、
String cust_no="123456";
StringBuffer qry = new StringBuffer();
qry.append(" SELECT * ");
qry.append(" FROM TORDERDETAIL ");
qry.append(" where CUST_NO ="+cust_no+" ");
pStmt = conn.prepareStatement(qry.toString());
rs = pStmt.executeQuery();
有什么本质的区别?
为什么一般都用2不用1,到底是为什么?
有人说是考虑sql注入安全问题什么的,请问下怎么个安全和不安全法?从哪些具体的方面考虑?
请大家帮忙解答一下,谢谢了!