gpt4 book ai didi

java - 有什么方法可以从数据库中批量而不是整体检索记录吗?

转载 作者:太空宇宙 更新时间:2023-11-04 06:38:50 24 4
gpt4 key购买 nike

我的代码检索大量记录,导致内存不足错误。我正在寻找一种方法来划分我想要检索的数据并处理该数据,清理内存,再次检索其余部分..

我可以使用 Rownum,但我不确定对于下一次检索,它只会考虑剩余的未检索记录。

有人可以帮助我吗?

提前致谢山姆

最佳答案

I am looking for a way to divide what I want to retrieve and process that data, clean the memory, retrieve the rest again.

您可以使用ResultSet#setFetchSize()

Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for this ResultSet object.

这是一个Example发布在教程点。

关于java - 有什么方法可以从数据库中批量而不是整体检索记录吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24951758/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com