Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ public Dialect createDialect(DialectResolutionInfo info) {
return new DB2zDialect( info );
}
case "QSQ": {
// i
// i, this only works if "use drda metadata version" property is set to true in the drivers properties
return new DB2iDialect( info );
}
}
}
if ("DB2 UDB for AS/400".equals(info.getDatabaseName())) {
// i
return new DB2iDialect( info );
}

return new DB2Dialect( info );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,9 @@ protected void closeConnection(Connection conn, Throwable t) {
}
}
finally {
allConnections.remove( conn );
if ( !allConnections.remove( conn ) ) {
ConnectionInfoLogger.INSTANCE.debug( "Connection remove failed." );
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,11 @@ protected JdbcEnvironmentImpl getJdbcEnvironmentUsingJdbcMetadata(
new SqlExceptionHelper( false ),
registry
);
temporaryJdbcSessionOwner.transactionCoordinator = registry.requireService( TransactionCoordinatorBuilder.class )
.buildTransactionCoordinator(
new JdbcCoordinatorImpl( null, temporaryJdbcSessionOwner, jdbcServices ),
() -> false
);
final JdbcCoordinatorImpl jdbcCoordinator = new JdbcCoordinatorImpl( null, temporaryJdbcSessionOwner, jdbcServices );

try {
temporaryJdbcSessionOwner.transactionCoordinator = registry.requireService( TransactionCoordinatorBuilder.class )
.buildTransactionCoordinator( jdbcCoordinator, () -> false );
return temporaryJdbcSessionOwner.transactionCoordinator.createIsolationDelegate().delegateWork(
new AbstractReturningWork<>() {
@Override
Expand Down Expand Up @@ -423,6 +421,10 @@ private int databaseMicroVersion(DatabaseMetaData metadata) throws SQLException
catch ( Exception e ) {
log.unableToObtainConnectionToQueryMetadata( e );
}
finally {
//noinspection resource
jdbcCoordinator.close();
}
// accessing the JDBC metadata failed
return getJdbcEnvironmentWithDefaults( configurationValues, registry, dialectFactory );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ public void testPreregisteredDialects() {
testDetermination( "DB2/SUN", DB2Dialect.class, resolver );
testDetermination( "DB2/LINUX390", DB2Dialect.class, resolver );
testDetermination( "DB2/AIX64", DB2Dialect.class, resolver );
testDetermination( "DB2 UDB for AS/400", DB2Dialect.class, resolver );
testDetermination( "DB2 UDB for AS/400", 7, 3, DB2Dialect.class, resolver );
testDetermination( "DB2 UDB for AS/400", DB2iDialect.class, resolver );
testDetermination( "DB2 UDB for AS/400", 7, 3, DB2iDialect.class, resolver );
testDetermination( "Oracle", 8, OracleDialect.class, resolver );
testDetermination( "Oracle", 9, OracleDialect.class, resolver );
testDetermination( "Oracle", 10, OracleDialect.class, resolver );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public Connection getConnection() throws SQLException {

@Override
public void closeConnection(Connection connection) throws SQLException {
connectionProvider.closeConnection( connection );
connectionProvider.closeConnection( ((ConnectionWrapper) connection).delegate );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void delist(Connection connection) {
System.err.println( "!!!Error trying to reset synchronization registry!!!" );
}
try {
delegate.closeConnection( connection );
delegate.closeConnection( ((ConnectionWrapper) connection).delegate );
}
catch (SQLException e) {
System.err.println( "!!!Error trying to close JDBC connection from delist callbacks!!!" );
Expand Down