Class JDBCUtils


  • public class JDBCUtils
    extends java.lang.Object
    Utilties related to JDBC.
    Since:
    10 Dec 2007
    Author:
    Mark Taylor
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.sql.Statement createStreamingStatement​(java.sql.Connection conn, boolean update)
      Returns a statement which tries its best to stream data.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • createStreamingStatement

        public static java.sql.Statement createStreamingStatement​(java.sql.Connection conn,
                                                                  boolean update)
                                                           throws java.sql.SQLException
        Returns a statement which tries its best to stream data. It may be necessary to jump through various (database/driver-dependent) hoops to persuade JDBC not to grab the whole query result and store it locally - doing that risks running out of heap memory in this JVM for large queries.

        Note that in some cases the supplied connection may have its autocommit mode modified by this call.

        Parameters:
        conn - connection
        update - true for an updatable set, false for read-only
        Returns:
        statement which (hopefully) streams results
        Throws:
        java.sql.SQLException