uk.ac.starlink.table.jdbc
Class JDBCUtils

java.lang.Object
  extended by uk.ac.starlink.table.jdbc.JDBCUtils

public class JDBCUtils
extends java.lang.Object

Utilties related to JDBC.

Since:
10 Dec 2007

Method Summary
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