假设我的查询是这样的,在这里conn是连接对象:如何打印Java预处理语句中的绑定变量。
String countrycode=91;//it is dynamic in my case
String query = "update tblemployeedata set countrycode='?';
PreparedStatement pstmtUpdate = conn.prepareStatement(query);
pstmtUpdate.setString(1,countrycode);
现在上述国家代码设置后,我希望看到形成像
update tblemployeedata set countrycode='91';
pstmtUpdate.executeUpdate();
这个查询将不会打印接收到的参数,它会打印?而不是params。 –
@BhavikAmbani否,它将打印参数值,如果它们在调用'toString'方法之前已经设置。 – Abubakkar
@阿布。它不会打印至少不在我的情况。在我的情况下它是打印:: [email protected] – Prateek