Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate » Other DB  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 如何获取巨型结果集的问题:
liangx





发贴: 37
积分: 0
于 2006-06-13 04:07 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在使用ResultSet装载巨型结果集(有四十万条记录)的时候。系统拋出了
java.lang.OutOfMemoryError错误。
目前解决方法是,只能在服务器端建立游标,一段段的把记录提取出来。
但是这样就缺乏灵活性。
另外还有一个方法.就是设置setFetchSize.但是使用这个方法需要3个条件
1.PostgreSQL必须大于版本7.4
2. Connection的AutoCommit必需设为false
3. Statement必需用ResultSet.TYPE_FORWARD_ONLY的属性来定义

有人能提供更好的方法吗?
先谢谢了



作者 Re:如何获取巨型结果集的问题: [Re:liangx]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2006-06-13 11:19 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
You may try to enlarge the max heap size of the java environment, something like
java -Xmx512M
(default is 64M, I think)
But this may not be a 更好的方法.



作者 Re:如何获取巨型结果集的问题: [Re:liangx]
jameszhang



CJSDN高级会员


发贴: 1594
积分: 111
于 2006-06-13 21:49 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
翻页


"First they ignore u, then they laugh at u, then they fight u, then u will win

Mahatma Gandhi"

作者 Re:如何获取巨型结果集的问题: [Re:why]
liangx





发贴: 37
积分: 0
于 2006-06-14 14:42 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
why wrote:
You may try to enlarge the max heap size of the java environment, something like
java -Xmx512M
(default is 64M, I think)
But this may not be a 更好的方法.

这绝对不是一个好办法。JAVA难度没有操作数据库的游标的方法吗?



作者 Re:如何获取巨型结果集的问题: [Re:liangx]
jameszhang



CJSDN高级会员


发贴: 1594
积分: 111
于 2006-06-23 21:55 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
你先说说都什么数据库有 “游标”?


"First they ignore u, then they laugh at u, then they fight u, then u will win

Mahatma Gandhi"


flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923