Example usage for java.sql Connection close

List of usage examples for java.sql Connection close

Introduction

In this page you can find the example usage for java.sql Connection close.

Prototype

void close() throws SQLException;

Source Link

Document

Releases this Connection object's database and JDBC resources immediately instead of waiting for them to be automatically released.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getHSQLConnection();

    DatabaseMetaData md = conn.getMetaData();
    System.out.println("supportsIntegrityEnhancementFacility - " + md.supportsIntegrityEnhancementFacility());

    conn.close();
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getHSQLConnection();

    DatabaseMetaData md = conn.getMetaData();
    System.out.println("supportsSchemasInPrivilegeDefinitions - " + md.supportsSchemasInPrivilegeDefinitions());

    conn.close();
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getConnection();
    Statement st = conn.createStatement();

    st.executeUpdate("create table survey (id int,myURL CHAR);");

    getTables(conn);// w  w w.  java  2  s .c  o m

    st.close();
    conn.close();
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    String driverName = "com.mysql.jdbc.Driver";
    String userName = "root";
    String password = "root";

    Class.forName(driverName).newInstance();
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jdbctutorial", userName,
            password);//from   w w  w .jav  a2  s  .  c  o m

    Statement st = con.createStatement();
    st.executeUpdate("DROP TABLE Employee1");
    con.close();
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getHSQLConnection();

    DatabaseMetaData md = conn.getMetaData();
    System.out//from ww  w  .jav  a 2s .  c  om
            .println("supportsStoredFunctionsUsingCallSyntax - " + md.supportsStoredFunctionsUsingCallSyntax());

    conn.close();
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getHSQLConnection();

    DatabaseMetaData md = conn.getMetaData();
    System.out// w w w  .  j  av a2 s .  com
            .println("supportsCatalogsInPrivilegeDefinitions - " + md.supportsCatalogsInPrivilegeDefinitions());

    conn.close();
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getHSQLConnection();

    DatabaseMetaData md = conn.getMetaData();
    System.out//from ww  w.  ja v  a2 s . c om
            .println("supportsDifferentTableCorrelationNames - " + md.supportsDifferentTableCorrelationNames());

    conn.close();
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getHSQLConnection();

    DatabaseMetaData md = conn.getMetaData();
    System.out.println(/*from www .  j  a  va 2 s .  co  m*/
            "supportsResultSetHoldability - " + md.supportsResultSetHoldability(ResultSet.FETCH_FORWARD));

    conn.close();
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getHSQLConnection();

    DatabaseMetaData md = conn.getMetaData();
    System.out.println(//from  w  ww  .j  a v  a2s .  c o m
            "supportsDataManipulationTransactionsOnly - " + md.supportsDataManipulationTransactionsOnly());

    conn.close();
}

From source file:edu.lternet.pasta.dml.database.pooling.PostgresDatabaseConnectionPool.java

public static void main(String arg[]) {
    PostgresDatabaseConnectionPool pool = new PostgresDatabaseConnectionPool();
    try {/*from www  .ja  v  a  2  s.com*/
        Connection conn = pool.getConnection();
        log.debug("conn=" + conn);
        conn.close();
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ConnectionNotAvailableException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}