01: /*
02: * Copyright 2006-2007 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
07: *
08: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
09: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
10: * the license for the specific language governing your rights and limitations.
11: *
12: * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
13: */
14: package org.pentaho.reportdesigner.crm.report.connection;
15:
16: import org.jetbrains.annotations.Nullable;
17:
18: import java.sql.Connection;
19: import java.sql.ResultSet;
20: import java.sql.SQLException;
21: import java.sql.Statement;
22:
23: /**
24: * User: Martin
25: * Date: 18.01.2006
26: * Time: 15:34:48
27: */
28: public class SQLUtil {
29: private SQLUtil() {
30: }
31:
32: public static void closeResultSet(@Nullable
33: ResultSet resultSet) {
34: if (resultSet != null) {
35: try {
36: resultSet.close();
37: } catch (SQLException e) {
38: throw new RuntimeException(e);
39: }
40: }
41: }
42:
43: public static void closeStatement(@Nullable
44: Statement statement) {
45: if (statement != null) {
46: try {
47: statement.close();
48: } catch (SQLException e) {
49: throw new RuntimeException(e);
50: }
51: }
52: }
53:
54: public static void closeConnection(@Nullable
55: Connection db) {
56: if (db != null) {
57: try {
58: db.close();
59: } catch (SQLException e) {
60: throw new RuntimeException(e);
61: }
62: }
63: }
64: }
|