Java SQL ResultSet createLargeResultSetStatement(Connection conn)

Here you can find the source of createLargeResultSetStatement(Connection conn)

Description

Returns a new statement on the specified connection with the necessary options to avoid running out of memory when reading a large result set.

License

Open Source License

Declaration

public static Statement createLargeResultSetStatement(Connection conn) throws SQLException 

Method Source Code

//package com.java2s;

import java.sql.Connection;

import java.sql.ResultSet;

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

public class Main {
    /**//w w w.jav a 2 s  . c  o  m
     * Returns a new statement on the specified connection with the necessary options
     * to avoid running out of memory when reading a large result set.
     */
    public static Statement createLargeResultSetStatement(Connection conn) throws SQLException {
        Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        stmt.setFetchSize(Integer.MIN_VALUE);
        return stmt;
    }
}

Related

  1. cleanupJDBCResouce(ResultSet rs, Statement stmt, String oldCatalog, Connection conn)
  2. consume(ResultSet rs)
  3. consume2(ResultSet rs)
  4. copyInt(ResultSet rs, int sourcePos, PreparedStatement stmt, int destPos)
  5. createLargeResultSetPreparedStatement(Connection conn, String sql)
  6. createTable(ResultSet rs)
  7. createUid(final String[] keys, final ResultSet rs, final String keySeparator)
  8. encodeHeader(ResultSetMetaData metaData)
  9. extractGeneratedId(ResultSet generatedKeys)