diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java index fcbf90d0ad..d34b31fd1e 100644 --- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java +++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java @@ -95,6 +95,7 @@ public abstract class AbstractJDBCDriver { synchronized (connection) { if (sqlProvider.closeConnectionOnShutdown()) { try { + connection.setAutoCommit(true); connection.close(); } catch (SQLException e) { logger.error(JDBCUtils.appendSQLExceptionDetails(new StringBuilder(), e)); diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCUtils.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCUtils.java index 24339386cf..bf57e9ace5 100644 --- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCUtils.java +++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCUtils.java @@ -82,7 +82,7 @@ public class JDBCUtils { errorMessage.append(' '); } formatSqlException(errorMessage, nextEx); - nextEx = exception.getNextException(); + nextEx = nextEx.getNextException(); level++; } while (nextEx != null); diff --git a/artemis-jdbc-store/src/main/resources/journal-sql.properties b/artemis-jdbc-store/src/main/resources/journal-sql.properties index f659ad48b5..0e6398a8db 100644 --- a/artemis-jdbc-store/src/main/resources/journal-sql.properties +++ b/artemis-jdbc-store/src/main/resources/journal-sql.properties @@ -84,3 +84,6 @@ create-journal-table.oracle=CREATE TABLE %s(id NUMBER(19),recordType NUMBER(5),c # 4 GiB max-blob-size.oracle=4294967296 table-names-case.oracle=upper + +# DB2 SQL statements +create-file-table.db2=CREATE TABLE %s (ID BIGINT GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1), FILENAME VARCHAR(255), EXTENSION VARCHAR(10), DATA BLOB, PRIMARY KEY(ID)) \ No newline at end of file diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java index efaace43c9..63c8295365 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java @@ -511,6 +511,7 @@ public abstract class ActiveMQTestBase extends Assert { connection.rollback(); } } + connection.setAutoCommit(true); } catch (Throwable e) { e.printStackTrace(); } finally { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java index 1b27380cc8..302c64a1a3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java @@ -83,7 +83,7 @@ public abstract class LargeMessageTestBase extends ActiveMQTestBase { public void tearDown() throws Exception { super.tearDown(); if (storeType == StoreConfiguration.StoreType.DATABASE) { - destroyTables(Arrays.asList("BINDINGS", "LARGE_MESSAGE", "MESSAGE")); + destroyTables(Arrays.asList("BINDINGS", "LARGE_MESSAGE", "MESSAGE", "NODE_MANAGER_STORE")); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/StorageManagerTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/StorageManagerTestBase.java index 6479d1e1f1..26c637b9a8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/StorageManagerTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/StorageManagerTestBase.java @@ -111,7 +111,7 @@ public abstract class StorageManagerTestBase extends ActiveMQTestBase { scheduledExecutorService.shutdown(); - destroyTables(Arrays.asList(new String[]{"MESSAGE", "BINDINGS", "LARGE_MESSAGE"})); + destroyTables(Arrays.asList(new String[]{"MESSAGE", "BINDINGS", "LARGE_MESSAGE", "NODE_MANAGER_STORE"})); super.tearDown(); if (exception != null) throw exception; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java index f5f83b5990..1f17550799 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java @@ -123,7 +123,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase { MBeanServerFactory.releaseMBeanServer(mbeanServer); super.tearDown(); if (storeType == StoreConfiguration.StoreType.DATABASE) { - destroyTables(Arrays.asList("BINDINGS", "LARGE_MESSAGE", "MESSAGE")); + destroyTables(Arrays.asList("BINDINGS", "LARGE_MESSAGE", "MESSAGE", "NODE_MANAGER_STORE")); } }