aspose file tools*
The moose likes JDBC 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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Can Watch "Can New topic
Author

Can't I have two simultaneosly active Resultsets?

Renato Veneroso
Greenhorn

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(MysqlIO.java:2125)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1099)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1272)
at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1218)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2233)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2193)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2174)
at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:536)
at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:266)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setAutoCommit(PoolingDataSource.java:338)
at net.sf.hibernate.transaction.JDBCTransaction.toggleAutoCommit(JDBCTransaction.java:104)
at net.sf.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:95)
at org.springframework.orm.hibernate.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:483)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:432)
at org.springframework.transaction.interceptor.TransactionAspectSupport.doCloseTransactionAfterThrowing(TransactionAspectSupport.java:259)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:60)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:596)
at br.com.stefanini.cobilling.criticado.modelo.negocio.GerenteExtracaoCriticados$$EnhancerByCGLIB$$e5ae0b1f.extrairCDRsRO(<generated>
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at br.com.stefanini.modelo.negocio.quartz.BeanMethodInvokerJob.executeInternal(BeanMethodInvokerJob.java:114)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:66)
at org.quartz.core.JobRunShell.run(JobRunShell.java:191)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)

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: 1134

Damien,
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,
Avi.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can't I have two simultaneosly active Resultsets?