View Javadoc

1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * 
4    * Copyright (C) 1999-2006, QOS.ch
5    * 
6    * This library is free software, you can redistribute it and/or modify it under
7    * the terms of the GNU Lesser General Public License as published by the Free
8    * Software Foundation.
9    */
10  
11  package ch.qos.logback.core.db;
12  
13  import java.sql.Connection;
14  import java.sql.SQLException;
15  import java.sql.Statement;
16  
17  /**
18   * @author Ceki Gülcü
19   * 
20   */
21  public class DBHelper {
22  
23    static public void closeConnection(Connection connection) {
24      if (connection != null) {
25        try {
26          connection.close();
27        } catch (SQLException sqle) {
28          // static utility classes should not log without an explicit repository
29          // reference
30        }
31      }
32    }
33  
34    public static void closeStatement(Statement statement) {
35      if (statement != null) {
36        try {
37          statement.close();
38        } catch (SQLException sqle) {
39        }
40      }
41    }
42  }