X
Xeth Waxman
Greetings experts. I'm having a problem retrieving values from a
CallableStatement after executing a Stored procedure. The RDBMS is MS
SQL Server 2k and the JDBC driver is JTDS 0.8.1. Here's the code I
have:
cs = con.prepareCall("{call spGetNextBatch(?,?,?,?,?,?,?,?,?)}");
cs.registerOutParameter(7, Types.INTEGER);
cs.registerOutParameter(8, Types.INTEGER);
cs.registerOutParameter(9, Types.INTEGER);
cs.setString(1, "GCC");
cs.setInt(2, 8);
cs.setInt(3, 802);
cs.setString(4, userName);
cs.setString(5, batchComment);
cs.setString(6, todayString);
//everything's set - execute
cs.execute();
while (cs.getMoreResults() == true && cs.getUpdateCount()!= -1)
{
//processing stuff
System.out.println("sizzling shizzle");
}
//get our values out
int batchKey = cs.getInt(7);
int nextBatchNo = cs.getInt(8);
int retVal = cs.getInt(9);
According to the profiler, the SP is executing and returning the
appropriate values. However, after running this code, all three value
(batchKey, nextBatchNo , and retVal) are all unitialized (0), which is
incorrect. I am stumped as to what I should be looking for or fixing,
and as always any assistance is appreciated.
CallableStatement after executing a Stored procedure. The RDBMS is MS
SQL Server 2k and the JDBC driver is JTDS 0.8.1. Here's the code I
have:
cs = con.prepareCall("{call spGetNextBatch(?,?,?,?,?,?,?,?,?)}");
cs.registerOutParameter(7, Types.INTEGER);
cs.registerOutParameter(8, Types.INTEGER);
cs.registerOutParameter(9, Types.INTEGER);
cs.setString(1, "GCC");
cs.setInt(2, 8);
cs.setInt(3, 802);
cs.setString(4, userName);
cs.setString(5, batchComment);
cs.setString(6, todayString);
//everything's set - execute
cs.execute();
while (cs.getMoreResults() == true && cs.getUpdateCount()!= -1)
{
//processing stuff
System.out.println("sizzling shizzle");
}
//get our values out
int batchKey = cs.getInt(7);
int nextBatchNo = cs.getInt(8);
int retVal = cs.getInt(9);
According to the profiler, the SP is executing and returning the
appropriate values. However, after running this code, all three value
(batchKey, nextBatchNo , and retVal) are all unitialized (0), which is
incorrect. I am stumped as to what I should be looking for or fixing,
and as always any assistance is appreciated.