jdbc 4 API
-
Thursday, August 09, 2012 8:40 PM
Getting exception calling setObject in a loop but not manually on a callable statement, jdbc4 drivers.
There is an exisiting tech note but does not provide a solution. http://support.microsoft.com/kb/919568
com.microsoft.sqlserver.jdbc.SQLServerException
: The index 1 is out of range.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(
SQLServerException.java:187)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setterGetParam(
SQLServerPreparedStatement.java:698)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(
SQLServerPreparedStatement.java:928)
at com.jpmc.spg.db.impl.SQLServerDbExecuter.setParametersForSP(
SQLServerDbExecuter.java:298)
at com.jpmc.spg.db.impl.SQLServerDbExecuter.executeProcedureWithParams(
SQLServerDbExecuter.java:132)
at com.jpmc.spg.db.impl.SQLServerDbExecuter.main(
SQLServerDbExecuter.java:338)
(int i = 0; i <= params.length-1; i++) {
System.
out.println("setParametersForSP i "+ (i+1) + "\n");
System.
out.println("setParametersForSP params[i] "+ params[i]+"\n");
String s = (String) params[i];
Object o =
new String(params[i].toString());
stmt.setObject(i+1, s, java.sql.Types.
VARCHAR);
}
}
All Replies
-
Monday, August 13, 2012 7:51 AMModerator
Hi samdhawan,
Thank you for your question.
I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.
Thank you for your understanding and support.
Best Regards,
Iric
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
Monday, August 13, 2012 8:44 PMModerator
Hi,
Can you post the difference in the code where it works and where it fails, and what the println statements emit?
Thanks,
Cathy Miller
-
Thursday, September 06, 2012 2:05 AMModerator
Hi samdhawan,
If you have time, please follow up with Cathy's questions here. Thanks.
Regards,
James

