开发者

Skipping ahead to a specific JDBC Record Number

开发者 https://www.devze.com 2022-12-10 20:48 出处:网络
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

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

精彩评论

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

关注公众号