Oracle 5.0 Reference Manual page 2095

Table of Contents

Advertisement

thus requiring the data to be re-sent, using the setBinaryStream(), setAsciiStream(),
setUnicodeStream(),
Consequently, to change the type of a parameter to a nonlarge one, you must call
clearParameters()
executed.
• ResultSet
By default, ResultSets are completely retrieved and stored in memory. In most cases this is the
most efficient way to operate, and due to the design of the MySQL network protocol is easier to
implement. If you are working with ResultSets that have a large number of rows or large values, and
cannot allocate heap space in your JVM for the memory required, you can tell the driver to stream
the results back one row at a time.
To enable this functionality, create a
stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
java.sql.ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(Integer.MIN_VALUE);
The combination of a forward-only, read-only result set, with a fetch size of
serves as a signal to the driver to stream result sets row-by-row. After this, any result sets created
with the statement will be retrieved row-by-row.
There are some caveats with this approach. You must read all of the rows in the result set (or close
it) before you can issue any other queries on the connection, or an exception will be thrown.
The earliest the locks these statements hold can be released (whether they be
locks or row-level locks in some other storage engine such as InnoDB) is when the statement
completes.
If the statement is within scope of a transaction, then locks are released when the transaction
completes (which implies that the statement needs to complete first). As with most other databases,
statements are not complete until all the results pending on the statement are read or the active
result set for the statement is closed.
Therefore, if using streaming results, process them as quickly as possible if you want to maintain
concurrent access to the tables referenced by the statement producing the result set.
• ResultSetMetaData
The
isAutoIncrement()
• Statement
When using versions of the JDBC driver earlier than 3.2.1, and connected to server versions earlier
than 5.0.3, the
setFetchSize()
described above.
Connector/J 5.0.0 and later include support for both
Statement.setQueryTimeout(). Both require MySQL 5.0.0 or newer server, and require a
separate connection to issue the
implementation creates an additional thread to handle the timeout functionality.
Note
Failures to cancel the statement for
themselves as
is currently no way to unblock the thread that is executing the query being
cancelled due to timeout expiration and have it throw the exception instead.
Connector/J (JDBC) Reference
or
setBlob()
setClob()
and set all parameters of the prepared statement again before it can be re-
Statement
method only works when using MySQL servers 4.0 and newer.
method has no effect, other than to toggle result set streaming as
KILL QUERY
RuntimeException
2075
method.
instance in the following manner:
Statement.cancel()
statement. In the case of setQueryTimeout(), the
setQueryTimeout()
rather than failing silently, as there
Integer.MIN_VALUE
table-level
MyISAM
and
may manifest

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents