- 论坛徽章:
- 0
|
jdbc大数量查询问题
是这样的。
先查询数据:
stmt = conn.createStatement (va.sql.ResultSet.TYPE_SCROLL_INSENSITIVE , java.sql.ResultSet.CONCUR_READ_ONLY ) ;
result =stmt.executeQuery("select * from its_czcounterdata_tbl t where t.opentime >; '20040701000000' and t.opentime < '20041030235959'"
然后使用:
while ( result.next () ) {
System.out.println ( result.getString ( "opentime" ) ) ;
。。
。。
对数据做转换
}
这个过程,估计JAVA是把所有数据从数据库中读入到内存中。所以当返回的结果集很大的时候,内存就装不下了,结果发生溢出。
因此有没有什么方法,在result.next () 的时候,内存只保留这次取的结果,而不必全部取到内存中? |
|