【问题标题】:Error : java.sql.SQLException: JZ0P1: Unexpected result type错误:java.sql.SQLException:JZ0P1:意外的结果类型
【发布时间】:2017-05-15 10:07:21
【问题描述】:

我的代码很简单

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

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

java.sql.SQLException:JZ0P1:意外的结果类型。 在 com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(未知来源) 在 com.sybase.jdbc3.jdbc.SybStatement.updateLoop(未知来源) 在 com.sybase.jdbc3.jdbc.SybStatement.executeUpdate(未知来源) 在 com.sybase.jdbc3.jdbc.SybCallableStatement.executeUpdate(未知 资源) 在 DBConnection.ExecuteProc(DBConnection.java:88)

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

【问题讨论】:

  • 有没有更新的驱动或者官方的可以试试?
  • 我不确定是否有新版本,但你能提供任何下载链接,我可以试试@ThorbjørnRavnAndersen
  • 对不起,没有。您可能想查看 Aqua Data Studio 中的文件以了解它们使用的驱动程序 - 您可以复制一个 jar 文件并使用它。

标签: java jdbc sybase


【解决方案1】:

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

大提示来自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();

【讨论】:

    【解决方案2】:

    对于旧的 jdbc 驱动程序,我注意到了

    PS.executeUpdate();
    

    时引发此错误
    PS.execute();
    

    没有

    【讨论】:

      猜你喜欢
      • 2015-12-11
      • 2013-08-04
      • 1970-01-01
      • 1970-01-01
      • 2019-10-24
      • 2018-12-29
      • 1970-01-01
      • 2016-06-02
      • 1970-01-01
      相关资源
      最近更新 更多