No statements may be issued when any streaming result sets are open and in use on a given connection
2011-09-30 11:26
721 查看
Noways, i have encountered a problem about mysql and ResultSet.
the Exception Trace:
java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@7834eb is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming
result sets before attempting more queries.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:930)
at com.mysql.jdbc.MysqlIO.checkForOutstandingStreamingData(MysqlIO.java:2646)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1861)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2548)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1846)
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 can not 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, you need to create a Statement instance in the following manner:
The combination of a forward-only, read-only result set, with a fetch size of
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 will have to 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.
Reference: http://bugs.mysql.com/bug.php?id=39156
http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-implementation-notes.html
the Exception Trace:
java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@7834eb is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming
result sets before attempting more queries.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:930)
at com.mysql.jdbc.MysqlIO.checkForOutstandingStreamingData(MysqlIO.java:2646)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1861)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2548)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1846)
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 can not 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, you need to create a Statement instance in the following manner:
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
Integer.MIN_VALUEserves
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 will have to 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.
Reference: http://bugs.mysql.com/bug.php?id=39156
http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-implementation-notes.html
相关文章推荐
- How to use Trusted Connection when SQL server and web Server are on two separate machines.
- File /hbase could only be replicated to 0 nodes instead of minReplication (=1). There are 30 datanode(s) running and no node(s) are excluded in this operation.
- No SAP systems are available when creating a new connection off an SAP source in Crystal Reports.
- Given an array of size N in which every number is between 1 and N, determine if there are any dupli
- Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
- An explicit value for the identity column in table can only be specified when a column list is used and IDENTITY_INSERT is ON
- Error: Flag android.useDeprecatedNdk is no longer supported and will be removed in the next version
- Several ports (8005, 8080, 8009) required by demo are already in use. The server may already be runn
- [Resolved] TF254006: No usable accounts are present in your configuration database. Use TfsConfig accounts /add to add an account and return to this wizard.
- Several ports (8005, 8080, 8009) required by Tomcat v6.0 Server at localhost are already in use. The server may already be runni
- 使用sqoop时,Ensure that you have called .close() on any active streaming result sets before attempting
- 'var' parameters are deprecated and will be removed in Swift 3 UIimage Gif [duplicate]
- Slow network performance when you open a file that is located in a shared folder on a remote network computer
- JWT vs JWS vs JWE - What They Are and When to Use Which
- on IRC, how to use secure connection(SSL) and get a cloak/vhost to hide your IP
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- 117.Which statements are true regarding the WHERE and HAVING clauses in a SELECT statement?
- [Win8]Wireshark: There are no interfaces on which a capture can be done