Q:

why throw error when call next on a resultset in groovy

I have the following code in groovy, and I need to control to loop the rows, so that I can split the rows in chucks in pass them to other threads (by actor). but looks like next() can't be called, I didn't the following test
def ORACLE = Sql.newInstance( "jdbc:oracle:thin:@.....", "xxx", "xxx", "oracle.jdbc.driver.OracleDriver" )
java.sql.ResultSet rs = ORACLE.executeQuery("select 1 as x from dual")  
rs.next()

error:
Oct 30, 2012 6:15:44 AM org.codehaus.groovy.runtime.StackTraceUtils sanitize
WARNING: Sanitizing stacktrace:
java.sql.SQLException: Closed Statement: next
  oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:242)

A:

the following will works: just use java stype jdbc.
import oracle.jdbc.driver.OracleTypes

driver = oracle.jdbc.driver.OracleDriver

Connection conn = DriverManager.getConnection(".....", "**", "**")  
Statement stmt = conn.createStatement();  
java.sql.ResultSet rs = stmt.executeQuery("select * from dual")  
while (rs.next()){
   println 'xx'
}

