[PATCH] Report URL on DB connection failure
Wald Commits
scm-commit at wald.intevation.org
Tue May 9 16:06:38 CEST 2017
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1494338742 -7200
# Node ID 19fa9fc39fa272d54cd9fdb4d7f5dae5bdea4ca3
# Parent 8abe94270f32cba724c4f4c9aa76ac0e05f4a4f8
Report URL on DB connection failure.
This should make it easier especially for Oracle to find out which
database is affected.
diff -r 8abe94270f32 -r 19fa9fc39fa2 backend/src/main/java/org/dive4elements/river/backend/utils/DBCPConnectionProvider.java
--- 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 {
More information about the Dive4Elements-commits
mailing list