Java SQL PreparedStatement close(PreparedStatement stat)

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

Description

close

License

Apache License

Declaration

public static void close(PreparedStatement stat) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static void close(Connection conn) {
        try {//from   w ww  . j  av  a2  s .  c o  m
            if (null != conn)
                conn.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public static void close(ResultSet rs) {
        try {
            if (null != rs)
                rs.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public static void close(Statement stat) {
        try {
            if (null != stat)
                stat.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public static void close(PreparedStatement stat) {
        try {
            if (null != stat)
                stat.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

Related

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