This discussion is archived
4 Replies Latest reply: Nov 8, 2006 5:39 AM by 807607 RSS

Prepared Statement invalid parameter index

807607 Newbie
Currently Being Moderated

i�ve a problem executin the following prepared statement:
PreparedStatement pstmt=context.getConnConn().prepareStatement("select destination,mailscan,login from N4U_rebuild2005_virtuser_temp where emailart='mailbox' and mailscan='V' and email='?' and domain='?' and session=?");
when i�m running throu the code:
pstmt.setString(1, email);
pstmt.setString(2, domain);
pstmt.setLong(3, sessionOid.longValue());
i get an error on the second line:
java.sql.SQLException: Invalid parameter index 2.
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.getParameter(
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setParameter(
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setString(

But why, cause i�ve 3 placeholders with the

Thx a lot