question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Batch fails when always encrypted is enabled in connection string

See original GitHub issue

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 © Microsoft Corporation Express Edition (64-bit) on Windows 10 Pro 10.0 <X64> (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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
shayannyc25commented, Jun 13, 2020

when will this fix be released?

0reactions
peterbaecommented, Jul 7, 2020

Fixed in #1378.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Always Encrypted - ODBC Driver for SQL Server
Enabling Always Encrypted in an ODBC application. The easiest way to enable both parameter encryption and resultset encrypted column decryption ...
Read more >
How to configure Always Encrypted in SQL Server 2016 using ...
First, add Column Encryption Setting = Enabled in the Additional Connection Parameters in the SSMS Connect to Server window. Now, query the ...
Read more >
Always Encrypted - Progress Documentation
When Always Encrypted is enabled, the driver uses the steps described in this section to retrieve keys and negotiate the decryption of encrypted...
Read more >
Solved: SQL Server Always Encrypted and Alteryx
Also, your database connection string must contain ColumnEncryption=Enabled. This setting instructs ODBC to encrypt data targeting encrypted ...
Read more >
Parameterization(Always Encrypted)- Inside stored proc
I have also enabled parameterization and also enabled column encryption setting for connection. Still getting the following error when creating ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found