Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Prepared Statement invalid parameter index

807607Nov 8 2006 — edited Nov 8 2006
Hello,

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(JtdsPreparedStatement.java:255)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setParameter(JtdsPreparedStatement.java:326)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setString(JtdsPreparedStatement.java:606)

But why, cause i�ve 3 placeholders with the
?
sign?

Thx a lot
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 6 2006
Added on Nov 8 2006
4 comments
6,803 views