java - 错误 : java. sql.SQLException:JZ0P1:意外的结果类型

标签 java jdbc sybase

我的代码很简单

CallableStatement stmt = Conn.prepareCall ("{call  Reconciliation (?)}");
stmt.setString(date);
PS.executeUpdate();

如果与解决方案相关,我正在使用 Sybase (Adaptive Server Enterprise/15.7.0) 和 jconnect4 驱动程序。 我的程序(Reconcliliation)非常庞大,所以我无法将其发布在这里,但在比较另外 2 个表(Deals1 和 Deals2)的数据后,它对某些 1 个表(Recon)进行了一些更新。它在过程中不返回任何out参数,它只需要1个in参数,即日期。 当我运行 java 代码并使用可调用语句运行过程时,它会在表中生成一些更新数据(Recon,计数为 500),之后得到的错误是这样的:

java.sql.SQLException: JZ0P1: Unexpected result type. at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.updateLoop(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.executeUpdate(Unknown Source) at com.sybase.jdbc3.jdbc.SybCallableStatement.executeUpdate(Unknown Source) at DBConnection.ExecuteProc(DBConnection.java:88)

我很确定我的程序(协调)中没有错误,因为当我使用命令 exec Reconciliation '04-Dec-2016' 在 Aqua Data Studio 中运行相同的过程时,它没有给出任何错误都会在表中产生完整更新(Recon,总计数为 800)。 java中也没有错误,因为它给出了sql异常。如果我没有错,中间一定有问题,即 jconnect 驱动程序或其他问题。 请帮我解决这个问题,谢谢。

最佳答案

老问题,但是当我遇到同样的问题时,我在网上找不到这个问题的任何好的答案。

最大的提示来自 http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc39001.0700/html/prjdbc0700/CHDGJJIG.htm

JZ0P1 Unexpected result type.

Description: The database has returned a result that the statement cannot 
return to the application, or that the application is not expecting at this
point. This generally indicates that the application is using JDBC incorrectly
to execute the query or stored procedure. If the JDBC application is connected 
to an Open Server application, it may indicate an error in the Open Server 
application that causes the Open Server to send unexpected sequences of results.

存储过程正在返回表。不要这样做:

PS.executeUpdate();

但是这样做:

ResultSet rs = callableStatement.executeQuery();

关于java - 错误 : java. sql.SQLException:JZ0P1:意外的结果类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41407536/

相关文章:

sybase - 我可以在 Sybase 中使用 MS SQL 语法吗?

java - 使用 Oracle Coherence 的 Spring 缓存

Java:如何从 JcomboBox 返回 JDBC 查询

java - 在eclipse java项目中加载dll文件

mysql - SQL插入多行

java - Maven 对所有项目使用相同的 API 文档(mvn 站点定制)

java - 如何禁用特定网址的 Spring 安全性

JAVA HBase : how to use CellUtil. getRowByte(单元格,整数)

postgresql - 如何禁用 Postgresql 消息翻译