简体   繁体   English

从 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.”

I have a Java project and a Sybase database.我有一个 Java 项目和一个 Sybase 数据库。 I am using JDBC to query a stored procedure.我正在使用 JDBC 来查询存储过程。

However, when I make a call to read a certain column value of the result set, I get the following error:但是,当我调用读取结果集的某个列值时,出现以下错误:

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)

Other columns are working fine.其他列工作正常。

Here is an example:这是一个例子:

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

What could I be doing wrong?我可能做错了什么?

The problem was that I haven't read the columns in the correct order.问题是我没有按正确的顺序阅读这些列。

The columns have to be read in the order as they are specified in the stored procedure.必须按照存储过程中指定的顺序读取列。

For example, when the stored procedure is:例如,当存储过程是:

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

Then the columns have to be read in this order:然后必须按以下顺序读取列:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.sql.SQLException: JZ006: Caught IOException: java.net.SocketTimeoutException: Read timed out use getCause() 查看错误链 - java.sql.SQLException: JZ006: Caught IOException: java.net.SocketTimeoutException: Read timed out use getCause() to see the error chain 从错误响应中获取数据时出现 java.io.IOException - java.io.IOException when getting data from error response 初始化进程时出现java.io.IOexception - java.io.IOexception when initializing a process 在android/java中调用createNewFile()时,为什么会出现:java.io.IOException: No such file or directory - When calling createNewFile() in android/java, why do I get: java.io.IOException: No such file or directory java.io.IOException java - java.io.IOException java MapReduce 中的 java.io.IOException - java.io.IOException in MapReduce java.io.IOException:读取序列化对象时过早EOF - java.io.IOException: Premature EOF while reading serialized object I/O 异常(java.io.IOException)在处理对{}的请求时捕获->unix://localhost:80:No such file or directory -when build image frm Dockerfile - I/O exception(java.io.IOException)caught when processing request to{}->unix://localhost:80:No such file or directory -when build image frm Dockerfile 读取HDFS并存储HBase时出现“ java.io.IOException:传递删除或放置” - “java.io.IOException: Pass a Delete or a Put” when reading HDFS and storing HBase java.io.IOException:读取Transfer-Encoding时过早的EOF:分块的HTTP响应 - java.io.IOException: Premature EOF when reading Transfer-Encoding: chunked http response
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM