ARTEMIS-1757 Improve DB2 compatibility (cherry picked from commit f5868a94e1a1534ddb8a44c854c132e8b20f1b9d)
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/9426f7a3 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/9426f7a3 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/9426f7a3 Branch: refs/heads/1.x Commit: 9426f7a3c8f40a2acebd68dd2474e8dd4568598e Parents: 717bc8f Author: Francesco Nigro <[email protected]> Authored: Fri Feb 16 15:45:45 2018 +0100 Committer: Clebert Suconic <[email protected]> Committed: Wed Mar 28 11:54:15 2018 -0400 ---------------------------------------------------------------------- .../activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java | 1 + .../org/apache/activemq/artemis/jdbc/store/drivers/JDBCUtils.java | 2 +- artemis-jdbc-store/src/main/resources/journal-sql.properties | 3 +++ .../org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java | 1 + .../tests/integration/largemessage/LargeMessageTestBase.java | 2 +- .../tests/integration/persistence/StorageManagerTestBase.java | 2 +- .../artemis/tests/integration/xa/BasicXaRecoveryTest.java | 2 +- 7 files changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9426f7a3/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java ---------------------------------------------------------------------- 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 fcbf90d..d34b31f 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)); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9426f7a3/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCUtils.java ---------------------------------------------------------------------- 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 3c055fa..b8d113e 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); return errorMessage; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9426f7a3/artemis-jdbc-store/src/main/resources/journal-sql.properties ---------------------------------------------------------------------- diff --git a/artemis-jdbc-store/src/main/resources/journal-sql.properties b/artemis-jdbc-store/src/main/resources/journal-sql.properties index e83efe5..2ed56be 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) GENERATED BY DEFAULT O # 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 http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9426f7a3/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java ---------------------------------------------------------------------- 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 b1fdd25..43fa6f1 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 @@ -505,6 +505,7 @@ public abstract class ActiveMQTestBase extends Assert { connection.rollback(); } } + connection.setAutoCommit(true); } catch (Throwable e) { e.printStackTrace(); } finally { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9426f7a3/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java ---------------------------------------------------------------------- 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 1b27380..302c64a 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")); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9426f7a3/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/StorageManagerTestBase.java ---------------------------------------------------------------------- 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 aba1304..77f8bcb 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 @@ -109,7 +109,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; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9426f7a3/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java ---------------------------------------------------------------------- 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 f5f83b5..1f17550 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")); } }
