使用jdbc和oracle驱动程序时存储结果集的位置 [英] Where Result set is stored while working with jdbc and oracle driver

查看:92
本文介绍了使用jdbc和oracle驱动程序时存储结果集的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦我使用带有oracle驱动程序的jdbc并运行select查询,查询的结果是存储在oracle内存或文件系统或临时表的服务器中吗?

Once I use jdbc with oracle driver and run select query is the result of the query is stored in the server of oracle memory or file system or temp table ?

如果我通过获取下一行来运行下一个方法是从oracle服务器内存加载到jvm内存吗?

and once I run the next method by getting the next row is it loaded from the oracle server memory to the jvm memory ?

如果我定义了获取的数量结果集上的大小为1000是否意味着1000行从oracle加载到JVM上的JDBC驱动程序?

And in case I define the the number of fetch size on the result set to be 1000 is this mean that the 1000 rows are loaded from the oracle to the JDBC driver on the JVM?

推荐答案

将在本地内存中提取默认行数(不是整个结果集)。一旦到达获取行的最后一行(比如通过执行next()并尝试访问下一行),如果结果中有更多行,则将对数据库进行另一次往返调用以获取下一行批量行。

A default number of rows (not the entire result set) will be fetched in your local memory. Once you reach at the last line of the fetched rows (say by doing next() and try to access next row) and if there are more rows in the result, then another round-trip call will be made to the database to fetch next batch of rows.

编辑1:

您可以看到有多少行这样做是为了获取结果集(请验证语法):

You can see how many rows your resultset is fetching at a time by doing this (please verify the syntax):

rs.beforeFirst(); // will put cursor before the first row
rs.last(); // will put cursor after the last line
int noOfRows = rs.getRow(); // will give you the current row number

编辑2:

如果你想在本地内存中获得比平常更多的行,你可以考虑 CachedRowSet 。即使这样也会进行往返,但通常会低于正常的结果集。但是,您应该考虑对您的应用程序进行一些性能检查。

If you want to get more rows in the local memory than usual, you may consider CachedRowSet. Even this will make round-trips, but generally less than normal resultset. However, you should consider doing some performance checks for your applications.

这篇关于使用jdbc和oracle驱动程序时存储结果集的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆