ARTEMIS-1757 Improve DB2 compatibility

(cherry picked from commit f5868a94e1)
This commit is contained in:
Francesco Nigro 2018-02-16 15:45:45 +01:00 committed by Clebert Suconic
parent 717bc8f09a
commit 9426f7a3c8
7 changed files with 9 additions and 4 deletions

View File

@ -95,6 +95,7 @@ public abstract class AbstractJDBCDriver {
synchronized (connection) { synchronized (connection) {
if (sqlProvider.closeConnectionOnShutdown()) { if (sqlProvider.closeConnectionOnShutdown()) {
try { try {
connection.setAutoCommit(true);
connection.close(); connection.close();
} catch (SQLException e) { } catch (SQLException e) {
logger.error(JDBCUtils.appendSQLExceptionDetails(new StringBuilder(), e)); logger.error(JDBCUtils.appendSQLExceptionDetails(new StringBuilder(), e));

View File

@ -82,7 +82,7 @@ public class JDBCUtils {
errorMessage.append(' '); errorMessage.append(' ');
} }
formatSqlException(errorMessage, nextEx); formatSqlException(errorMessage, nextEx);
nextEx = exception.getNextException(); nextEx = nextEx.getNextException();
level++; level++;
} while (nextEx != null); } while (nextEx != null);
return errorMessage; return errorMessage;

View File

@ -84,3 +84,6 @@ create-journal-table.oracle=CREATE TABLE %s(id NUMBER(19) GENERATED BY DEFAULT O
# 4 GiB # 4 GiB
max-blob-size.oracle=4294967296 max-blob-size.oracle=4294967296
table-names-case.oracle=upper 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))

View File

@ -505,6 +505,7 @@ public abstract class ActiveMQTestBase extends Assert {
connection.rollback(); connection.rollback();
} }
} }
connection.setAutoCommit(true);
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {

View File

@ -83,7 +83,7 @@ public abstract class LargeMessageTestBase extends ActiveMQTestBase {
public void tearDown() throws Exception { public void tearDown() throws Exception {
super.tearDown(); super.tearDown();
if (storeType == StoreConfiguration.StoreType.DATABASE) { if (storeType == StoreConfiguration.StoreType.DATABASE) {
destroyTables(Arrays.asList("BINDINGS", "LARGE_MESSAGE", "MESSAGE")); destroyTables(Arrays.asList("BINDINGS", "LARGE_MESSAGE", "MESSAGE", "NODE_MANAGER_STORE"));
} }
} }

View File

@ -109,7 +109,7 @@ public abstract class StorageManagerTestBase extends ActiveMQTestBase {
scheduledExecutorService.shutdown(); 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(); super.tearDown();
if (exception != null) if (exception != null)
throw exception; throw exception;

View File

@ -123,7 +123,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase {
MBeanServerFactory.releaseMBeanServer(mbeanServer); MBeanServerFactory.releaseMBeanServer(mbeanServer);
super.tearDown(); super.tearDown();
if (storeType == StoreConfiguration.StoreType.DATABASE) { if (storeType == StoreConfiguration.StoreType.DATABASE) {
destroyTables(Arrays.asList("BINDINGS", "LARGE_MESSAGE", "MESSAGE")); destroyTables(Arrays.asList("BINDINGS", "LARGE_MESSAGE", "MESSAGE", "NODE_MANAGER_STORE"));
} }
} }