Skip to content

Disable JDBC batch updates for SQL Server in CancelableJdbcTemplate (… - #2550

Open
DG47 wants to merge 1 commit into
OHDSI:masterfrom
DG47:fix/sqlserver-batch-update
Open

DG47 wants to merge 1 commit into
OHDSI:masterfrom
DG47:fix/sqlserver-batch-update

Conversation

@DG47

@DG47 DG47 commented Oct 7, 2026

Copy link
Copy Markdown

…fixes #2528)

The SQL Server JDBC driver executes a Statement batch as a single T-SQL batch, so when the same analysis SQL (with temp tables) is run several times within one batch, re-creating a temp table that was dropped earlier in the batch fails with "There is already an object named '#...' in the database". This surfaces in pathway analyses with multiple target cohorts.

Treat jdbc:sqlserver connections like Impala and IRIS and execute the statements one by one instead of batching them.

Adds CancelableJdbcTemplateTest covering the SQL Server and batched paths.

…ixes OHDSI#2528)

The SQL Server JDBC driver executes a Statement batch as a single T-SQL
batch, so when the same analysis SQL (with temp tables) is run several
times within one batch, re-creating a temp table that was dropped earlier
in the batch fails with "There is already an object named '#...' in the
database". This surfaces in pathway analyses with multiple target cohorts.

Treat jdbc:sqlserver connections like Impala and IRIS and execute the
statements one by one instead of batching them.

Adds CancelableJdbcTemplateTest covering the SQL Server and batched paths.
@chrisknoll

Copy link
Copy Markdown
Collaborator

There seems to be a git action failure when it tries to run the build action. Can you confirm behavior on your side?

@DG47

DG47 commented Oct 8, 2026 •

Copy link
Copy Markdown
Author

There seems to be a git action failure when it tries to run the build action. Can you confirm behavior on your side?
@chrisknoll
Confirmed, it's not from this PR. Two things are breaking build on master right now:
▎ 1. The ubuntu-24.04 runner image (20261004) upgraded Maven 3.9.16 → 3.10.0. Under 3.10 the miredot-plugin 2.4.0 POM no longer resolves ${toolsjar}, so plugin resolution fails before compile. I reproduced this locally on JDK 8: it's fine on 3.9.16 and fails on 3.10.0, and -Dtoolsjar doesn't work around it. Pinning Maven 3.9.x in ci.yaml fixes it.
▎ 2. CDMResultsAnalysisRunnerTest (from #2549) doesn't compile on JDK 8: any() is ambiguous between the Object[] and PreparedStatementSetter overloads of query. any(PreparedStatementSetter.class) fixes it.

@chrisknoll

chrisknoll commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Edit:

saw your other PR we'll let that go through then merge master to this, then see if PR resolves.

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.

BatchUpdates in SqlServer leads to 'table already exists' on temp tables that were dropped

2 participants