Close the specified database connection. @param dbConnection The connection to be closed
(Connection dbConnection)
| 609 | * @param dbConnection The connection to be closed |
| 610 | */ |
| 611 | protected void close(Connection dbConnection) { |
| 612 | |
| 613 | // Do nothing if the database connection is already closed |
| 614 | if (dbConnection == null) { |
| 615 | return; |
| 616 | } |
| 617 | |
| 618 | // Commit if autoCommit is false |
| 619 | try { |
| 620 | if (!dbConnection.getAutoCommit()) { |
| 621 | dbConnection.commit(); |
| 622 | } |
| 623 | } catch (SQLException e) { |
| 624 | manager.getContext().getLogger().error(sm.getString("dataSourceStore.commitSQLException"), e); |
| 625 | } |
| 626 | |
| 627 | // Close this database connection, and log any errors |
| 628 | try { |
| 629 | dbConnection.close(); |
| 630 | } catch (SQLException e) { |
| 631 | manager.getContext().getLogger().error(sm.getString("dataSourceStore.close"), e); |
| 632 | } |
| 633 | } |
| 634 | |
| 635 | /** |
| 636 | * Release the connection, if it is associated with a connection pool. |
no test coverage detected