Where Result set is stored while working with jdbc and oracle driver

后端 未结 4 1194
盖世英雄少女心
盖世英雄少女心 2021-01-04 09:27

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 ?

and once I

4条回答
  •  天命终不由人
    2021-01-04 10:05

    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.

    EDIT 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
    

    EDIT 2:

    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.

提交回复
热议问题