Skip to content

Connection.rollback method does not work for the Azure Synapse "serverless" database #2071

@LonwoLonwo

Description

@LonwoLonwo

Driver version

Provide the JDBC driver version - the latest

SQL Server version

Database: Azure Synapse "serverless"
Server: Microsoft SQL Server 12.00.2531, Microsoft Azure SQL Data Warehouse - 10.0.15318.0

Client Operating System

Windows 10

Problem description

One of our users has problem with data transfer operation in the NOT auto-commit mode in our program because we use the standard Connection method - rollback.

dbeaver/dbeaver#18820

The issue that he has during this method execution:

com.microsoft.sqlserver.jdbc.SQLServerException:  '@@TRANCOUNT' is not supported.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
	at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:283)
	at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:129)
	at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:37)
	at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:26)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection$1ConnectionCommand.doExecute(SQLServerConnection.java:3316)
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7418)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:3274)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectionCommand(SQLServerConnection.java:3320)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.rollback(SQLServerConnection.java:3516)

As I can see in the documentation

This syntax is not supported by serverless SQL pool in Azure Synapse Analytics.

The user uses not the latest driver, but I do not see in the code any conditions for the serverless databases:

public void rollback() throws SQLServerException {
loggerExternal.entering(loggingClassName, "rollback");
if (loggerExternal.isLoggable(Level.FINER) && Util.isActivityTraceOn()) {
loggerExternal.finer(toString() + ACTIVITY_ID + ActivityCorrelator.getNext().toString());
}
checkClosed();
if (databaseAutoCommitMode) {
SQLServerException.makeFromDriverError(this, this, SQLServerException.getErrString("R_cantInvokeRollback"),
null, true);
} else
connectionCommand("IF @@TRANCOUNT > 0 ROLLBACK TRAN", "Connection.rollback");
loggerExternal.exiting(loggingClassName, "rollback");
}

Expected behavior

Using another function for the Azure Synapse "serverless" database

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementAn enhancement to the driver. Lower priority than bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions