From 42b9ea81187f61c533117f05c5aa65149b6b49aa Mon Sep 17 00:00:00 2001 From: Claus Nagel Date: Fri, 19 Jul 2024 09:31:55 +0200 Subject: [PATCH] set autoCommit to false by default --- .../src/main/java/org/citydb/database/DatabaseManager.java | 3 ++- citydb-database/src/main/java/org/citydb/database/Pool.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/citydb-database/src/main/java/org/citydb/database/DatabaseManager.java b/citydb-database/src/main/java/org/citydb/database/DatabaseManager.java index 34f7fce7..c1c4f61e 100644 --- a/citydb-database/src/main/java/org/citydb/database/DatabaseManager.java +++ b/citydb-database/src/main/java/org/citydb/database/DatabaseManager.java @@ -83,7 +83,8 @@ public void connect(ConnectionDetails connectionDetails, DatabaseAdapterManager connection.getDatabase())); properties.setInitialSize(0); - properties.setDefaultAutoCommit(true); + properties.setDefaultAutoCommit(false); + properties.setRollbackOnReturn(true); dataSource = new DataSource(properties); dataSource.setLoginTimeout(connection.getPoolOptions() diff --git a/citydb-database/src/main/java/org/citydb/database/Pool.java b/citydb-database/src/main/java/org/citydb/database/Pool.java index 2c841542..1a20676e 100644 --- a/citydb-database/src/main/java/org/citydb/database/Pool.java +++ b/citydb-database/src/main/java/org/citydb/database/Pool.java @@ -46,6 +46,6 @@ public Connection getConnection(boolean autoCommit) throws SQLException { } public Connection getConnection() throws SQLException { - return getConnection(true); + return getConnection(false); } }