Close the specified database connection. @param dbConnection The connection to be closed
(Connection dbConnection)
| 343 | * @param dbConnection The connection to be closed |
| 344 | */ |
| 345 | protected void close(Connection dbConnection) { |
| 346 | |
| 347 | // Do nothing if the database connection is already closed |
| 348 | if (dbConnection == null) { |
| 349 | return; |
| 350 | } |
| 351 | |
| 352 | // Commit if not auto committed |
| 353 | try { |
| 354 | if (!dbConnection.getAutoCommit()) { |
| 355 | dbConnection.commit(); |
| 356 | } |
| 357 | } catch (SQLException e) { |
| 358 | containerLog.error(sm.getString("dataSourceRealm.commit"), e); |
| 359 | } |
| 360 | |
| 361 | // Close this database connection, and log any errors |
| 362 | try { |
| 363 | dbConnection.close(); |
| 364 | } catch (SQLException e) { |
| 365 | containerLog.error(sm.getString("dataSourceRealm.close"), e); // Just log it here |
| 366 | } |
| 367 | |
| 368 | } |
| 369 | |
| 370 | /** |
| 371 | * Open the specified database connection. |
no test coverage detected