what does the following error mean: java.sql.sqlexception missing in or out parameter at index
I get the following error when wo开发者_StackOverflow社区rking on some JDBC code:
java.sql.sqlexception missing in or out parameter at index: 6
Can somebody explain what this means? More generally, is there a website/set of documentation that will explain what an error statement means?
You have a statement like:
select foo from bar where a=? and b=? and c=? ...
You code binds the values to parameters:
st.setInteger(1,123); // goes to a
st.setString(2,"hello"); // goes to b
...
Now, parameter #6 is not bound, no value provided. Statement doesn't know what value to send over to DB (it will not send NULL by default). You should do something like this if parameter value is not known:
st.setNull(6,Types.VARCHAR);
Can you paste your PreparedStatement code? What this means is that you have have an extra ? in the statement for which you're not setting a value.
精彩评论