This repository was archived by the owner on Mar 26, 2026. It is now read-only.
Merged
Conversation
Adds support for running DDL statements when a connection is in autocommit=false mode. By default, DDL statements are only allowed when no transaction is active. That is; no query or DML statement has been executed which activated a read/write transaction. A new flag is added that can be used to revert the behavior back to the original behavior where DDL is always refused when autocommit=false. The same flag can also be used to make the API behave the same as MySQL and Oracle, where any active transaction is automatically committed whenever a DDL statement is encountered. Concretely this means that the following is now allowed: ``` set autocommit=false; create table Singers (SingerId INT64, Name STRING(MAX)) PRIMARY KEY (SingerId); ``` The following is by default NOT allowed, unless ddlInTransactionMode=AUTO_COMMIT_TRANSACTION ``` set autocommit=false; select * from singers; -- This starts a transaction create table Albums (AlbumId INT64) PRIMARY KEY (AlbumId); -- This is not allowed ```
gcf-merge-on-green Bot
pushed a commit
that referenced
this pull request
May 4, 2024
🤖 I have created a release *beep* *boop* --- ## [2.18.0](https://togithub.com/googleapis/java-spanner-jdbc/compare/v2.17.1...v2.18.0) (2024-05-04) ### Features * Allow DDL with autocommit=false ([#1600](https://togithub.com/googleapis/java-spanner-jdbc/issues/1600)) ([a61c25d](https://togithub.com/googleapis/java-spanner-jdbc/commit/a61c25d8f90460ec507b383dbaee0ca686104ba8)) * Support concurrent transactions on the emulator ([#1601](https://togithub.com/googleapis/java-spanner-jdbc/issues/1601)) ([7123991](https://togithub.com/googleapis/java-spanner-jdbc/commit/71239912a8078569dcd985314810131e593c0ed7)) ### Bug Fixes * ClassCastException in Spring Data JDBC sample ([#1595](https://togithub.com/googleapis/java-spanner-jdbc/issues/1595)) ([e96a86a](https://togithub.com/googleapis/java-spanner-jdbc/commit/e96a86a4b82ac4b47bd1ce25e810f01299597339)) ### Dependencies * Update dependency com.google.cloud:google-cloud-spanner-bom to v6.66.0 ([#1599](https://togithub.com/googleapis/java-spanner-jdbc/issues/1599)) ([84ea11a](https://togithub.com/googleapis/java-spanner-jdbc/commit/84ea11ac27635dbe6fb101134767d14488dde8c2)) * Update dependency com.google.cloud:sdk-platform-java-config to v3.30.0 ([#1597](https://togithub.com/googleapis/java-spanner-jdbc/issues/1597)) ([40a7212](https://togithub.com/googleapis/java-spanner-jdbc/commit/40a721237c79882e55d86d48402c64cc09782522)) * Update dependency org.mybatis.dynamic-sql:mybatis-dynamic-sql to v1.5.1 ([#1596](https://togithub.com/googleapis/java-spanner-jdbc/issues/1596)) ([f54beb2](https://togithub.com/googleapis/java-spanner-jdbc/commit/f54beb20d6bbe3f4974385c4758ba77d31d25ce3)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for running DDL statements when a connection is in autocommit=false mode. By default, DDL statements are only allowed when no transaction is active. That is; no query or DML statement has been executed which activated a read/write transaction.
A new flag is added that can be used to revert the behavior back to the original behavior where DDL is always refused when autocommit=false. The same flag can also be used to make the API behave the same as MySQL and Oracle, where any active transaction is automatically committed whenever a DDL statement is encountered.
Concretely this means that the following is now allowed:
The following is by default NOT allowed, unless
ddlInTransactionMode=AUTO_COMMIT_TRANSACTION