Skip to content

Commit cedce98

Browse files
committed
https://github.com/manifold-systems/manifold-ij/issues/40
- close connection after failed init
1 parent 95e1662 commit cedce98

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

manifold-deps-parent/manifold-sql-rt/src/main/java/manifold/sql/rt/impl/HikariConnectionProvider.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,18 @@ public Connection getConnection( String configName, Class<?> classContext )
7979
@Override
8080
public Connection getConnection( DbConfig dbConfig ) throws SQLException
8181
{
82-
//noinspection resource
8382
HikariDataSource ds = _dataSources.computeIfAbsent( dbConfig.getName(), __ ->
8483
makeDataSource( dbConfig, dbConfig.getBuildUrlOtherwiseRuntimeUrl() ) );
8584
Connection connection = ds.getConnection();
86-
dbConfig.init( connection, Compiler );
85+
try
86+
{
87+
dbConfig.init( connection, Compiler );
88+
}
89+
catch( Throwable t )
90+
{
91+
connection.close();
92+
throw t;
93+
}
8794
return connection;
8895
}
8996

0 commit comments

Comments
 (0)