Java SQL PreparedStatement close(PreparedStatement preparedStatement)

Here you can find the source of close(PreparedStatement preparedStatement)

Description

close

License

Open Source License

Declaration

public static void close(PreparedStatement preparedStatement) throws SQLException 

Method Source Code


//package com.java2s;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import java.sql.SQLException;
import java.sql.Statement;

public class Main {
    public static void close(CallableStatement callableStatement) throws SQLException {
        close(callableStatement, null, null, null);
    }/* www .ja v a 2 s .  c  o m*/

    public static void close(CallableStatement callableStatement, ResultSet resultSet) throws SQLException {
        close(callableStatement, null, null, resultSet);
    }

    public static void close(PreparedStatement preparedStatement) throws SQLException {
        close(null, preparedStatement, null, null);
    }

    public static void close(PreparedStatement preparedStatement, ResultSet resultSet) throws SQLException {
        close(null, preparedStatement, null, resultSet);
    }

    public static void close(Statement statement) throws SQLException {
        close(null, null, statement, null);
    }

    public static void close(Statement statement, ResultSet resultSet) throws SQLException {
        close(null, null, statement, resultSet);
    }

    public static void close(CallableStatement callableStatement, PreparedStatement preparedStatement,
            Statement statement, ResultSet resultSet) throws SQLException {
        if (resultSet != null) {
            resultSet.close();
        }
        if (callableStatement != null) {
            callableStatement.close();
        }
        if (preparedStatement != null) {
            preparedStatement.close();
        }
        if (statement != null) {
            statement.close();
        }
    }
}

Related

  1. addBatch(PreparedStatement prepStmt)
  2. addValuesToPreparedStatement(PreparedStatement preparedStatement, List values)
  3. close(PreparedStatement stat)
  4. closePreparedStatement(Map psMap)
  5. closePreparedStatement(PreparedStatement pstmt)
  6. closePreparedStatement(Statement ps)