RE: TDS_RET_STATUS exception
- From: Mugunthan <Mugunthan@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 22 Nov 2006 22:43:02 -0800
Thanks for reporting this issue. Yes it looks like an issue in our 1.1
driver. We will fix this issue in the next release.
"Kev" wrote:
I have just moved from Sybase to SQL Server 2005 (9.0.2047) and am using the.
1.1 JDBC driver with Java 1.5.0 06.
I'm getting a TDS_RET_STATUS SQLServerException.
I have multiple processes updating a particular table and when the load is
high enough the occasional deadlock can occur.
This will generate an SQLException (error code 1205) in a jdbc stored
procedure call, stating:
SQL Error Message:Transaction (Process ID 77) was deadlocked on lock
resources with another process and has
been chosen as the deadlock victim. Rerun the transaction.
This is ok as the java code that executed the deadlocked CallableStatement
simply retries after a short delay.
However, what I'm currently getting is that the first retry attempt fails,
not due to another deadlock but to the following exception:
SQL Error Code:0, SQL State:null, SQL Error Message:No TDS_RET_STATUS was
found for the stored procedure output parameters.
com.microsoft.sqlserver.jdbc.SQLServerException: No TDS_RET_STATUS was found
for the stored procedure output parameters.
at
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown
Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.seekToOutParams(Unknown
Source)
at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.getPrepStmtHandle(Unknown Source)
at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doPrepExec(Unknown
Source)
at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PreparedStatementExecutionRequest.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown
Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(Unknown
Source)
The stored procedure has the following parameters:
create procedure getProc
(
@BatchSize integer
,@Now datetime
,@StartPriority integer = null
)
It always returns a status integer.
The java code that calls the procedure is as follows:
......
con.setAutoCommit(true);
CallableStatement cs = con.prepareCall("{? = call getProc(?,?)}");
cs.registerOutParameter(1, java.sql.Types.INTEGER);
cs.setInt(2, m_batchSize);
final Date now = new Date();
final Timestamp processStartTime = new Timestamp(now.getTime());
cs.setTimestamp(3, processStartTime);
boolean returnedResultSet = executeWithDeadlockRetry(cs); // This method
calls retval = ps.execute(); and has retry functionality for deadlocks
// now process result set
.....
The executeWithDeadlockRetry(cs) call simply re-executes the callable
statement after a deadlock. It doesn't close it and create a new one or close
and open a new connection etc before a retry. It waits 0.5sec before a retry.
Any help much appreciated.
- Follow-Ups:
- RE: TDS_RET_STATUS exception
- From: Kev
- RE: TDS_RET_STATUS exception
- References:
- TDS_RET_STATUS exception
- From: Kev
- TDS_RET_STATUS exception
- Prev by Date: Re: Incoming TDS RPC Protocol Stream Incorrect Error for SQL Server 2005
- Next by Date: RE: TDS_RET_STATUS exception
- Previous by thread: TDS_RET_STATUS exception
- Next by thread: RE: TDS_RET_STATUS exception
- Index(es):
Relevant Pages
|