152 boolean succesfullyConnected = false; |
152 boolean succesfullyConnected = false; |
153 boolean succesfullyConfigured = false; |
153 boolean succesfullyConfigured = false; |
154 |
154 |
155 try { |
155 try { |
156 DatabaseDefinition dd = configurationProvider.getConfiguration().getDatabase(dbName); |
156 DatabaseDefinition dd = configurationProvider.getConfiguration().getDatabase(dbName); |
157 if (dd == null) { |
157 log.log(Level.FINE, "Database definition was loaded from configuration"); |
158 log.log(Level.FINE, "No database with this name is configured: {0}", dbName); |
158 succesfullyConfigured = true; |
159 } else { |
159 try (DatabaseConnection dc = dd.connect()) { |
160 log.log(Level.FINE, "Database definition was loaded from configuration"); |
160 succesfullyConnected = dc.test(); |
161 succesfullyConfigured = true; |
161 } |
162 try (DatabaseConnection dc = dd.connect()) { |
162 log.log(Level.FINE, "Database connection test was successful"); |
163 succesfullyConnected = dc.test(); |
|
164 } |
|
165 log.log(Level.FINE, "Database connection test was successful"); |
|
166 } |
|
167 } catch (ConfigurationException | SQLException e) { |
163 } catch (ConfigurationException | SQLException e) { |
168 log.log(Level.SEVERE, "Error during testing connection", e); |
164 log.log(Level.SEVERE, "Error during testing connection", e); |
169 } |
165 } |
170 |
166 |
171 return new Object[]{dbName, succesfullyConfigured, succesfullyConnected}; |
167 return new Object[]{dbName, succesfullyConfigured, succesfullyConnected}; |