Skip to content

Fix | Fix batch insert failing when AE is turned on#1378

Merged
ulvii merged 4 commits intomicrosoft:devfrom
peterbae:github-1301
Jul 3, 2020
Merged

Fix | Fix batch insert failing when AE is turned on#1378
ulvii merged 4 commits intomicrosoft:devfrom
peterbae:github-1301

Conversation

@peterbae
Copy link
Copy Markdown
Contributor

@peterbae peterbae commented Jul 2, 2020

Fixes issue #1301. Testing shows it also fixes #1360, but will need to confirm from user.

Continues from PR #1334. Testing has been carried over, but the fix is different.

The problem was coming from executing sp_describe_parameter_encryption. This statement is executed when AE is turned on to retrieve the encryption parameter. Code was currently written in such a way that sp_describe_paramter_encryption was being executed twice (or multiple times) if AE was enabled, which caused the driver to think that the current request was completed, which caused the driver to error out during the actual execution of the batch statement (and a plethora of other problems). Adding logic to only run param fetch once and save the encryption metadata for the subsequent batches as well solves this problem.

Before: (PrecisionScaleTest::testMultiBatch)
image

After:
image

Testing was done against with both AE and AEv2 enabled.

Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can not insert into a table with always encrypted cols using executeBatch

4 participants