I assume that props is an instance of Properties or similar. If so, then the props.getProperty("scoreversion") should run at the Java level, not the database. Instead of this:
String sql = "update scoreconfig set scorestatus=0 where scoreversion=?"; PreparedStatement ps = con.prepareStatement(sql);
... or if scoreversion is int, use this instead of the setString line:
// It scoreversion is an int: ps.setInt(1, Integer.parseInt(props.getProperty("scoreversion")));
... etc., convert as appropriate.
Basically, when you use prepareStatement , do you use ? where the parameters should go, and then you use setXyz on the PreparedStatement instance to set these parameters. (Oddly enough, they start with 1 , not 0 ) Note that even when the parameter is String, you do not put quotation marks around it in SQL, which you pass to prepareStatement ; which are processed for you (along with avoiding this line to prevent SQL injection , so PreparedStatement and setXyz are your friends, you will recognize them well).
source share