Skip to content

Commit

Permalink
https://github.com/manifold-systems/manifold-ij/issues/40
Browse files Browse the repository at this point in the history
- close connection after failed init
  • Loading branch information
rsmckinney committed Jun 29, 2024
1 parent 95e1662 commit cedce98
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,18 @@ public Connection getConnection( String configName, Class<?> classContext )
@Override
public Connection getConnection( DbConfig dbConfig ) throws SQLException
{
//noinspection resource
HikariDataSource ds = _dataSources.computeIfAbsent( dbConfig.getName(), __ ->
makeDataSource( dbConfig, dbConfig.getBuildUrlOtherwiseRuntimeUrl() ) );
Connection connection = ds.getConnection();
dbConfig.init( connection, Compiler );
try
{
dbConfig.init( connection, Compiler );
}
catch( Throwable t )
{
connection.close();
throw t;
}
return connection;
}

Expand Down

0 comments on commit cedce98

Please sign in to comment.