Skip to content

Batch fails when always encrypted is enabled in connection string #1301

@jezbera

Description

@jezbera

Driver version

8.2.2.jre11 (older versions are affected, too)

SQL Server version

Microsoft SQL Server 2016 (SP2) (KB4052908) - 13.0.5026.0 (X64) Mar 18 2018 09:11:49 Copyright (c) Microsoft Corporation Express Edition (64-bit) on Windows 10 Pro 10.0 (Build 18363: ) (Hypervisor)

Client Operating System

Windows/Linux

JAVA/JVM version

11.0.6

Table schema

Table will be created by test.
create table TEST2 (KEY1 numeric(19,0) not null, KEY2 numeric(19,0) not null, primary key (KEY1, KEY2))

Problem description

Prepare database with always encrypted feature. Update connection details in ExecuteBatchTest.java and run tests in attached gradle project.

  1. Expected behaviour:
    No column is encrypted, so it does not matter, whether columnEncryptionSetting is enabled or not.
  2. Actual behaviour:
    Only test with connection string containing "columnEncryptionSetting=Enabled" fails.
  3. Error message/stack trace:
    java.lang.AssertionError at com.microsoft.sqlserver.jdbc.TDSCommand.onRequestComplete(IOBuffer.java:7397) at com.microsoft.sqlserver.jdbc.TDSWriter.writePacket(IOBuffer.java:4071) at com.microsoft.sqlserver.jdbc.TDSWriter.endMessage(IOBuffer.java:3185) at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:7556) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatementBatch(SQLServerPreparedStatement.java:2786) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtBatchExecCmd.doExecute(SQLServerPreparedStatement.java:2675) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2979) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(SQLServerPreparedStatement.java:2076) at ExecuteBatchTest.executeBatch(ExecuteBatchTest.java:65) at ExecuteBatchTest.test(ExecuteBatchTest.java:38)
  4. Any other details that can be helpful:
    Second batch fails.

JDBC trace logs

mssql-jdbc-trace.txt

Reproduction code

mssql-batch-sample.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions