When using a PreparedStatement object, the parameters you set become part of the state of the object. That is, the parameters persist between uses of a PreparedStatement instance.
For example:
String ssql = "select name, empno from emp where " +
"name = ? and deptno = ?"
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, "JONES");
ps.setInt(2, 3400);
//select .... where name='JONES' and deptno=3400
rset = ps.executeQuery();
If the code then changes the first parameter and executes another query, the PreparedStatement "remembers" that the second parameter is set to 3400:
ps.setString(1, "SMITH");
//select .... where name='SMITH' and deptno=3400
rset = ps.executeQuery();
Here is what the Javadoc says about clearParameters():
"In general, parameter values remain in force for repeated use of a Statement. Setting a parameter value automatically clears its previous value. However, in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling clearParameters."
So, as you stated, your code can work just fine without calling clearParameters(). I have no idea what those "some cases" are, and I've never needed to use clearParameters().
[This message has been edited by Kevin Mukhar (edited January 23, 2001).]