I recently encountered this problem with Java PreparedStatements. I have the following code:
String selectSql1
= \"SELECT `value` FROM `sampling_numb
public ResultSet select1(String sql, int randNum) {
try {
this.stmt = con.prepareStatement(sql);
stmt.setInt(1, randNum);
return this.stmt.executeQuery();
} catch (SQLException e) {
e.printStackTrace();
return null;
}
}
for reference see below code
PreparedStatement statement = con.prepareStatement("SELECT EMP_ID,EMP_PWD FROM employee " +
"WHERE EMP_ID = '"+param1+"'");
ResultSet result = statement.executeQuery();