changeset 8814:19fa9fc39fa2

Report URL on DB connection failure. This should make it easier especially for Oracle to find out which database is affected.
author Tom Gottfried <tom@intevation.de>
date Tue, 09 May 2017 16:05:42 +0200
parents 8abe94270f32
children c4ce25093953
files backend/src/main/java/org/dive4elements/river/backend/utils/DBCPConnectionProvider.java
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/backend/utils/DBCPConnectionProvider.java	Fri Apr 28 19:03:56 2017 +0200
+++ b/backend/src/main/java/org/dive4elements/river/backend/utils/DBCPConnectionProvider.java	Tue May 09 16:05:42 2017 +0200
@@ -259,9 +259,17 @@
         if (ds.getNumActive() == ds.getMaxTotal()) {
             log.warn("Maximum number of database connections in pool in use!");
         }
-        Connection conn = ds.getConnection();
-        log.trace("Return connection with hash: " + conn.hashCode());
-        return conn;
+
+        try {
+            Connection conn = ds.getConnection();
+            log.trace("Return connection with hash: " + conn.hashCode());
+            return conn;
+        }
+        catch (SQLException sqle) {
+            throw new SQLException(
+                "Connecting to database " + ds.getUrl() + " failed",
+                sqle);
+        }
     }
 
     public void closeConnection(Connection conn) throws SQLException {

http://dive4elements.wald.intevation.org