Example usage for java.sql Connection setHoldability

List of usage examples for java.sql Connection setHoldability

Introduction

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

Prototype

void setHoldability(int holdability) throws SQLException;

Source Link

Document

Changes the default holdability of ResultSet objects created using this Connection object to the given holdability.

Usage

From source file:net.fender.sql.DriverConnectionFactory.java

public Connection getConnection() throws SQLException {
    // don't log properties as it contains plain text user name and password
    log.debug("creating connection to " + driver + " " + url);
    Connection connection = driver.connect(url, properties);
    if (autoCommit != null) {
        connection.setAutoCommit(autoCommit);
    }//from  ww w .  j  a  v a2s  . c o m
    if (holdability != null) {
        connection.setHoldability(holdability.getHoldability());
    }
    if (readOnly != null) {
        connection.setReadOnly(readOnly);
    }
    if (transactionIsolation != null) {
        connection.setTransactionIsolation(transactionIsolation.getLevel());
    }
    if (catalog != null) {
        connection.setCatalog(catalog);
    }
    return connection;
}

From source file:com.adaptris.jdbc.connection.FailoverDatasourceTest.java

@Test
public void testInfo() throws Exception {
    Connection conn = new MyProxy();

    try {/* w ww . j  a  v  a 2  s  .co  m*/
        try {
            conn.getMetaData();
        } catch (SQLException e) {

        }
        try {
            conn.setCatalog(conn.getCatalog());
        } catch (SQLException e) {

        }
        try {
            conn.setReadOnly(conn.isReadOnly());
        } catch (SQLException e) {

        }
        try {
            conn.setTransactionIsolation(conn.getTransactionIsolation());
        } catch (SQLException e) {

        }
        try {
            conn.setTransactionIsolation(conn.getTransactionIsolation());
        } catch (SQLException e) {

        }
        try {
            conn.getWarnings();
        } catch (SQLException e) {

        }
        try {
            conn.clearWarnings();
        } catch (SQLException e) {

        }
        try {
            conn.setHoldability(conn.getHoldability());
        } catch (SQLException e) {

        }

        try {
            conn.setSchema(conn.getSchema());
        } catch (SQLException e) {

        }

    } finally {
        JdbcUtil.closeQuietly(conn);
    }

}