diff --git a/dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/datasource/DatabasePoolUtils.java b/dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/datasource/DatabasePoolUtils.java index 9d7d9ada1a9a..417b3bafac9b 100644 --- a/dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/datasource/DatabasePoolUtils.java +++ b/dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/datasource/DatabasePoolUtils.java @@ -342,10 +342,12 @@ private static DataSource createC3p0DbPool(PoolConfig config) } public static void testConnection(DataSource dataSource) throws SQLException { - Connection conn = dataSource.getConnection(); - try (Statement stmt = conn.createStatement()) { + try (Connection conn = dataSource.getConnection(); + Statement stmt = conn.createStatement()) { stmt.executeQuery("select 'connection_test' as connection_test;"); + } catch (SQLException e) { + log.error(e.getMessage()); } } }