开发者

Skipping ahead to a specific JDBC Record Number

What is the best way to skip ahead to a specific record number in a Java JDBC resultse开发者_StackOverflow中文版t?


You can use ResultSet#absolute() for this. Whether it works depends on the JDBC driver used however.

But a new question would rise: why don't you just let the SQL query return only the particular row of interest? That would have been much more efficient than moving the cursor forth and back. Or if you're interested in any of the rows, but only wanted to get the particular row, better map the ResultSet to a List<Data> so that you can use List#get().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜