从 ResultSet 读取 Sybase 列时,我得到 "JZ006: Caught IOException: java.io.IOException: JZ0R3: Column is DEAD."

When reading Sybase column from ResultSet I get "JZ006: Caught IOException: java.io.IOException: JZ0R3: Column is DEAD."

我有一个 Java 项目和一个 Sybase 数据库。我正在使用 JDBC 查询存储过程。

但是,当我调用读取结果集的某个列值时,出现以下错误:

Caused by: java.sql.SQLException: JZ006: Caught IOException: java.io.IOException: JZ0R3: Column is DEAD.  This is an internal error; please report it to Sybase technical support.
    at com.sybase.jdbc4.jdbc.ErrorMessage.raiseError(ErrorMessage.java:753)
    at com.sybase.jdbc4.jdbc.ErrorMessage.raiseErrorCheckDead(ErrorMessage.java:1166)
    at com.sybase.jdbc4.tds.TdsJdbcInputStream.getString(TdsJdbcInputStream.java:2371)
    at com.sybase.jdbc4.jdbc.SybResultSet.getString(SybResultSet.java:320)

其他列工作正常。

这是一个例子:

var id = rs.getLong("id"); // works fine
var created = rs.getObject("created"); // throws an error

我可能做错了什么?

问题是我没有按正确的顺序阅读这些专栏。

必须按照存储过程中指定的顺序读取列。

例如当存储过程为:

create or replace procedure my_procedure()
as
begin
    select
           o.id, o.name, o.created
    from order o
end
go

然后必须按以下顺序阅读这些列:

var id = rs.getLong("id"); // works fine
var name = rs.getString("name"); // !!! was missing in the question's example above
var created = rs.getObject("created"); // works fine now