RE: TDS_RET_STATUS exception

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Would you be able to do a patch release for this problem?

"Shelby Goerlitz [MSFT]" wrote:

Kev:

Next release is in progress and currently scheduled for the first half of
2007.

-shelby

Shelby Goerlitz
Microsoft SQL Server Data Programmability


"Kev" wrote:

Okay, thanks for investigating.
In the mean time I have a work around - I'm creating a new CallableStatement
for each retry.
When is the next release scheduled?

"Mugunthan" wrote:

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.

.



Relevant Pages

  • RE: TDS_RET_STATUS exception
    ... "Kev" wrote: ... high enough the occasional deadlock can occur. ... However, what I'm currently getting is that the first retry attempt fails, ... found for the stored procedure output parameters. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • TDS_RET_STATUS exception
    ... high enough the occasional deadlock can occur. ... This is ok as the java code that executed the deadlocked CallableStatement ... However, what I'm currently getting is that the first retry attempt fails, ... found for the stored procedure output parameters. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • RE: TDS_RET_STATUS exception
    ... JDBC driver with Java 1.5.0 06. ... high enough the occasional deadlock can occur. ... However, what I'm currently getting is that the first retry attempt fails, ... found for the stored procedure output parameters. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • RE: No TDS_RET_STATUS was found
    ... high enough the occasional deadlock can occur. ... This is ok as the java code that executed the deadlocked CallableStatement ... what I'm currently getting is that the first retry attempt falls ... found for the stored procedure output parameters. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • RE: TDS_RET_STATUS exception
    ... In the mean time I have a work around - I'm creating a new CallableStatement ... high enough the occasional deadlock can occur. ... However, what I'm currently getting is that the first retry attempt fails, ... found for the stored procedure output parameters. ...
    (microsoft.public.sqlserver.jdbcdriver)