ResultSet,TYPE_FORWARD_ONLY?我不能自由移动游标的位置吗?

qdzhulf 2002-01-04 05:11:44
ResultSet rs=stmt.executeQuery("select * from tbname");
rs.absolute(5); //出错:Result set type is TYPE_FORWARD_ONLY
请问有什么方法可以使用,rs.absolute();
谢谢
...全文
242 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2002-01-04
  • 打赏
  • 举报
回复
再问:java如此限制,是基于什么样的考虑?游标自由移动有何缺点?
「已注销」 2002-01-04
  • 打赏
  • 举报
回复
给分了
skyyoung 2002-01-04
  • 打赏
  • 举报
回复

createStatement
public Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws SQLException
Creates a Statement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the createStatement method above, but it allows the default result set type and concurrency to be overridden.

Parameters:
resultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
Returns:
a new Statement object that will generate ResultSet objects with the given type and concurrency
Throws:
SQLException - if a database access error occurs or the given parameters are not ResultSet constants indicating type and concurrency
Since:
1.2

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧