RE: No TDS_RET_STATUS was found
- From: Kev <Kev@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 10 Nov 2006 03:36:01 -0800
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 but from a different
scenario to the other newsgroup postings.
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 falls
over, 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 on 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.
Could there be some kind of corruption going on inside the CallableStatement
object after a deadlock that prevents it being retried successfully?
Any help much appreciated.
"David Olix" wrote:
Hi Chris (and Joe!),.
Yes, this problem happens whenever you have updatetext in the SQL. The
problem is fixed in the June v1.1 CTP, which you can download from here:
http://msdn.microsoft.com/data/ref/jdbc/ . The fix will also be in the
v1.1 release, which we are targeting for August.
Thank you for digging into this issue,
--David Olix
JDBC Development
- Prev by Date: RE: collation SQL_EBCDIC037_CP1_CS_AS
- Next by Date: Re: Upgrading SQL Server 2005 JDBC Driver 1.1 from SQL Server 2000 Driver, in Tomcat 5.5 env
- Previous by thread: Re: Incoming TDS RPC Protocol Stream Incorrect Error for SQL Server 2005
- Next by thread: Re: Upgrading SQL Server 2005 JDBC Driver 1.1 from SQL Server 2000 Driver, in Tomcat 5.5 env
- Index(es):
Relevant Pages
|