java.sql.SQLException: Before start of result set

错误原因:

如API中所述

API:

A table of data representing a database result set, which is usually generated by executing a statement that queries the database. A
ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The
next method moves the cursor to the next row。

就是说游标初始化的位置在首行之前。

解决方法:

在使用rs前要调用rs.next()方法

java.sql.SQLException: Before start of result set,布布扣,bubuko.com

时间: 2025-01-02 16:38:35

java.sql.SQLException: Before start of result set的相关文章

java中mysql查询报错java.sql.SQLException: Before start of result set

异常:java.sql.SQLException: Before start of result set 解决方法:使用rs.getString();前一定要加上rs.next(); sm = conn.createStatement(); ResultSet rs = null; String sql_max = "SELECT id FROM a WHERE name= '" + name + "' ORDER BY online_time DESC LIMIT 1&qu

Error getting nested result map values for 'user_inf'. Cause: java.sql.SQLException: Cannot convert

问题?Error getting nested result map values for 'user_inf'.  Cause: java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 8 to TIMESTAMP. 错误:org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.  Cause:

解决java.sql.SQLException: ORA-01789: query block has incorrect number of result columns

java.sql.SQLException: ORA-01789: query block has incorrect number of result columns at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305) at oracle.jdbc.driver.

java.sql.SQLException: Unknown type '246 in column 0 of 1 in binary-encoded result set的解决办法

最近在大学毕设项目基础上新增一些功能,基于Struts2开源框架,数据库采用的是MySQL.写完后台的新功能代码,单元测试也顺利通过,去整合前台,但是当使用JSP页面操作的时候,没想到报异常了.截图如下: java.sql.SQLException: Unknown type '246 in column 2 of 4 in binary-encoded result set. 纳闷了,为什么能够通过JUnit呢? 几经查找,都说是MySQL的bug,更换了MySQL新版本的驱动包,比如mysq

Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: java.sql.SQLException: 不支持的特性

mybatis插入数据时报错: Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: java.sql.SQLException: 不支持的特性 at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFacto

Oracle java.sql.SQLException: 数字溢出

六月 30, 2016 5:47:47 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions信息: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]六月 30, 2016 5:47:47 下午 org.springf

java.sql.SQLException: Operation not allowed after ResultSet closed

转自:http://blog.csdn.net/hellobobantang/article/details/7173622 java.sql.SQLException: Operation not allowed after ResultSet closedat com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)at com.mysql.jdbc.SQLError.createSQLException(SQLError.

SQL state [72000]; error code [1013]; ORA-03111: 通信通道收到中断; java.sql.SQLException: ORA-01745: 无效的主机/绑定变量名;java.sql.SQLException: ORA-01013: 用户请求取消当前的操作

1.oracle批量插入 2.java.sql.SQLException: ORA-01745: 无效的主机/绑定变量名(数据太多的时候出现解决方法限制条数插入) /** * 按指定大小,分隔集合,将集合按规定个数分为n个部分 * @param <T> * * @param list * @param len * @return */ public static <T> List<List<T>> splitList(List<T> list,

struts2+hibernate+spring简单整合且java.sql.SQLException: No suitable driver 问题解决

最近上j2ee的课,老师要求整合struts2+hibernate+spring,我自己其实早早地有准备弄的,现在都第9个项目了,无奈自己的思路和头绪把自己带坑了,当然也是经验问题,其实只是用myeclipse进行整合的,本来也没那么多问题,看视频吧居然好多要手打,我不喜欢看不下去放弃了,教程把就是一堆坑,最最让人不解的是明明有一个冲突是需要解决的,但我看到的教程居然都没有提到,还有一个错误居然好多人都好像自动忽略一样,能解决我问题的都是要漫长的找,所以我一定一定要把这个过程记录下来,给第一次搞