Java SQL ResultSet Close close(ResultSet resultSet, Statement statement, Connection connection)

Here you can find the source of close(ResultSet resultSet, Statement statement, Connection connection)

Description

close

License

Open Source License

Declaration

public static void close(ResultSet resultSet, Statement statement, Connection connection) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.SQLException;

public class Main {
    public static void close(ResultSet resultSet, Statement statement, Connection connection) {
        try {//from  w ww . j ava 2 s .co m
            if (resultSet != null)
                resultSet.close();
            if (statement != null)
                statement.close();
            if (connection != null)
                connection.close();
        } catch (SQLException ignored) {
        }

    }

    public static void close(ResultSet resultSet, Statement statement) {
        try {
            if (resultSet != null)
                resultSet.close();
            if (statement != null)
                statement.close();
        } catch (SQLException ignored) {
        }
    }

    public static void close(ResultSet resultSet) {
        try {
            if (resultSet != null)
                resultSet.close();
        } catch (SQLException ignored) {
        }

    }

    public static void close(Statement statement) {
        try {
            if (statement != null)
                statement.close();
        } catch (SQLException ignored) {
        }

    }

    public static void close(Connection connection) {
        try {
            if (connection != null)
                connection.close();
        } catch (SQLException ignored) {
        }
    }
}

Related

  1. close(ResultSet resultSet)
  2. close(ResultSet resultSet)
  3. close(ResultSet resultSet)
  4. close(ResultSet resultSet)
  5. close(ResultSet resultSet, CallableStatement statement, Connection connection)
  6. close(ResultSet resultSet, Statement statement, Connection connection)
  7. close(ResultSet resultSet, Statement statement, Connection connection)
  8. close(ResultSet rs)
  9. close(ResultSet rs)