Two Laptop Bag
The moose likes JDBC and Relational Databases and the fly likes Can't I have two simultaneosly active Resultsets? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Can Watch "Can New topic

Can't I have two simultaneosly active Resultsets?

Renato Veneroso

Joined: Mar 18, 2004
Posts: 12
Hi all,

I have an application that calls a method from a DAO class based on parameters provided by the user. The method returns an iterator based on a resultset. The main application works on that iterator and, for each item from it writes a line to a file on disk. Usually I have the resultset with thousands of lines which means my iterator and the resultset are active for a long time. As the execution of the application is assincronous (scheduled by Quartz) sometimes I have one active resultset whist trying to get a new one. That's the time when the problem arises. I'm getting the following error message:

java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@9aafb3 is still active. Only one streaming result set may be open and in use per-connection. Ensure that you have called .close() on any active result sets before attempting more queries.
at com.mysql.jdbc.MysqlIO.checkForOutstandingStreamingData(
at com.mysql.jdbc.MysqlIO.sendCommand(
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
at com.mysql.jdbc.MysqlIO.sqlQuery(
at com.mysql.jdbc.Connection.execSQL(
at com.mysql.jdbc.Connection.execSQL(
at com.mysql.jdbc.Connection.execSQL(
at com.mysql.jdbc.Connection.setAutoCommit(
at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setAutoCommit(
at net.sf.hibernate.transaction.JDBCTransaction.toggleAutoCommit(
at net.sf.hibernate.transaction.JDBCTransaction.rollback(
at org.springframework.orm.hibernate.HibernateTransactionManager.doRollback(
at org.springframework.transaction.interceptor.TransactionAspectSupport.doCloseTransactionAfterThrowing(
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.springframework.scheduling.quartz.QuartzJobBean.execute(
at org.quartz.simpl.SimpleThreadPool$

What exactly does this message mean? Can't I have two simultaneosly active resultsets? I'm using MySql. Is this a MySql limitation?

Any help is welcome.

Thanks in advance.
[ September 06, 2005: Message edited by: Bear Bibeault ]
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1141

I'm only guessing, but it looks like a limitation of mySQL or DBCP.

There is definitely no such limitation when working with Oracle.

Good Luck,
I agree. Here's the link:
subject: Can't I have two simultaneosly active Resultsets?
It's not a secret anymore!