zoukankan      html  css  js  c++  java
  • java.sql.ResultSet.next() 光标常见错误总结分析

    java.sql.ResultSet.next()


    Moves the cursor forward one row from its current position. A ResultSet cursor is initially positioned before the first row; the first call to the method next makes the first row the current row; the second call makes the second row the current row, and so on.
    When a call to the next method returns false, the cursor is positioned after the last row. Any invocation of a ResultSet method which requires a current row will result in a SQLException being thrown. If the result set type is TYPE_FORWARD_ONLY, it is vendor specified whether their JDBC driver implementation will return false or throw an SQLException on a subsequent call to next.

    If an input stream is open for the current row, a call to the method next will implicitly close it. A ResultSet object's warning chain is cleared when a new row is read.

    Returns:
    true if the new current row is valid; false if there are no more rows
    Throws:
    SQLException - if a database access error occurs or this method is called on a closed result set


    即执行Java sql语句得到一个resultset之后。直接去获取结果集的内容是无法获取到数据的。因为一个结果集的光标是停留在第一行前面的。你要处理第一行的数据,就首先ResultSet.next(),将光标移动到第一行。如果光标已经超出有效行数,会报SQLException

  • 相关阅读:
    MXF文件结构浅析
    Windows FFMPEG开发环境配置
    从文件中读取yuv和h264数据
    TS封装格式
    H.264学习笔记
    【Web Shell】- 技术剖析中国菜刀
    【Web Shell】- 技术剖析中国菜刀 – Part I
    【硬件】- 显卡命名规则
    【硬件】- 英特尔CPU命名中的产品线后缀
    【硬件】- 英特尔CPU命名规则
  • 原文地址:https://www.cnblogs.com/happyliuyi/p/10524705.html
Copyright © 2011-2022 走看看