Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/backend/utils/DBCPConnectionProvider.java @ 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 | 8179cca1796a |
children | ff27548d078c |
comparison
equal
deleted
inserted
replaced
8813:8abe94270f32 | 8814:19fa9fc39fa2 |
---|---|
257 log.trace("_ idle connections: " + ds.getNumIdle()); | 257 log.trace("_ idle connections: " + ds.getNumIdle()); |
258 log.trace("_ max active: " + ds.getMaxTotal()); | 258 log.trace("_ max active: " + ds.getMaxTotal()); |
259 if (ds.getNumActive() == ds.getMaxTotal()) { | 259 if (ds.getNumActive() == ds.getMaxTotal()) { |
260 log.warn("Maximum number of database connections in pool in use!"); | 260 log.warn("Maximum number of database connections in pool in use!"); |
261 } | 261 } |
262 Connection conn = ds.getConnection(); | 262 |
263 log.trace("Return connection with hash: " + conn.hashCode()); | 263 try { |
264 return conn; | 264 Connection conn = ds.getConnection(); |
265 log.trace("Return connection with hash: " + conn.hashCode()); | |
266 return conn; | |
267 } | |
268 catch (SQLException sqle) { | |
269 throw new SQLException( | |
270 "Connecting to database " + ds.getUrl() + " failed", | |
271 sqle); | |
272 } | |
265 } | 273 } |
266 | 274 |
267 public void closeConnection(Connection conn) throws SQLException { | 275 public void closeConnection(Connection conn) throws SQLException { |
268 log.trace("Close connection with hash: " + conn.hashCode()); | 276 log.trace("Close connection with hash: " + conn.hashCode()); |
269 conn.close(); | 277 conn.close(); |