views:

401

answers:

1

Hi everybody,

Sometimes I get the following from SQL Server 2005 when executing a stored procedure:

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot roll back T1. No transaction or savepoint of that name was found.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown Source)
    at com.mchange.v2.c3p0.impl.NewProxyCallableStatement.executeUpdate(NewProxyCallableStatement.java:2160)
    at com.sm.persistence.dao.TransactionRejectDAO.callSpMoveTransaction(TransactionRejectDAO.java:631)
    ... 6 more

Any ideas?

When the connection pooling mechanism attempts to close the prepared statement:

Nov 9, 2009 9:32:55 AM com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement close
WARNING: SQLServerPreparedStatementID:201 ( ConnectionID:139 TransactionID:0x1A00000039000000): Error (ignored) closing PreparedHandle:0
com.microsoft.sqlserver.jdbc.SQLServerException: The server failed to resume the transaction. Desc:390000001a.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(Unknown Source)
    at com.microsoft.sqlserver.jdbc.TDSParser.parse(Unknown Source)
    at com.microsoft.sqlserver.jdbc.TDSParser.parse(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$1PreparedHandleClose.doExecute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.closePreparedHandle(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.close(Unknown Source)
    at com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
    at com.mchange.v2.c3p0.stmt.GooGooStatementCache.synchronousDestroyStatement(GooGooStatementCache.java:413)
    at com.mchange.v2.c3p0.stmt.GooGooStatementCache.closeAll(GooGooStatementCache.java:351)
    at com.mchange.v2.c3p0.impl.NewPooledConnection.closeAllCachedStatements(NewPooledConnection.java:673)
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:543)
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:234)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470)
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Nov 9, 2009 9:32:55 AM com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement close
WARNING: SQLServerPreparedStatementID:186 ( ConnectionID:139 TransactionID:0x1A00000039000000): Error (ignored) closing PreparedHandle:0

The stored procedure contains a nested transaction T1 which I believe is unnecessary. Could that be the problem?

Thanks

A: 

The first error is due to the fact that you have a named nested transaction that you are trying to rollback to - naming a nested transaction (naming means typing something like "BEGIN TRANSACTION ", which in your case = T1) is allowed, but rolling back to a named nested transaction is not supported and results in an error.

See this topic for more information.

chadhoc
thanks. I will change it and let you know
DaUltimateTrooper