简体   繁体   English

尝试从DB2表读取时的SQLCode -991

[英]SQLCode -991 when trying to read from DB2 table

I've created and compiled a program in Cobol, but when trying to run and test it with a JCL job, I'm getting this error when reading the output. 我已经在Cobol中创建并编译了一个程序,但是当尝试使用JCL作业运行和测试该程序时,读取输出时出现此错误。 (The program compiles and the job runs without errors themselves) (程序编译并且作业本身没有错误)

SQLCODE = -991, ERROR: CALL ATTACH WAS UNABLE TO ESTABLISH AN IMPLICIT CONNECT OR OPEN TO DB2. SQLCODE = -991,错误:呼叫连接无法建立隐式连接或对DB2的打开。 RC1=0008 RC2=00F30034 RC1 = 0008 RC2 = 00F30034

SQLSTATE = 57015 SQLSTATE = 57015

Now I don't understand why this error occurs. 现在我不明白为什么会发生此错误。 The DB2 database is up and running, I can access it myself. DB2数据库已启动并正在运行,我可以自己访问它。 I can't find an error in my program code either. 我在程序代码中也找不到错误。 Googling it sadly doesn't provide me a clear solution, all I can find is that the issue is either the compiling job for the program, the jcl to run it or issues with the DB2 itself. 可悲的是,谷歌搜索并没有为我提供一个明确的解决方案,我只能找到问题所在,要么是程序的编译工作,运行它的jcl要么是DB2本身的问题。

Have you done a bind and did it work !!!, The error indicates the plan does not exist or is not authorized . 您是否进行了绑定并成功了!!!,该错误表明该计划不存在未被授权
You need to talk to people at your site about the Compile/Bind process and who authorises 需要与您的站点的人讨论有关编译/绑定过程以及授权人的信息。

If you do not know know about Mainframe Cobol/DB2 compile process, try reading this 如果您不了解Mainframe Cobol / DB2编译过程,请尝试阅读此内容

Basically ---> 基本上--->

                                 Cobol program 
    Cobol DB2 Program ---+---->  with no  SQL   ---> Compile ----->  Executable
                         |       but calls Plan  
                         |
                         +---->  DBRM (SQL)   -----> Bind   ------>  DB2 Plan    

It is the plan that needs the DB2 authorisation to run the SQL !!! 这是一个需要DB2授权才能运行该SQL 计划 You might be able to authorise the Plan or you might need to see the DBA's 您可能可以授权该计划,或者可能需要查看DBA的

With DB2 COBOL, There is Co-Compiler (was a pre-compiler) that strips out the SQL and creates the DBRM (basically aa special SQL procedure). 使用DB2 COBOL,有一个Co-Compiler(是一个预编译器),它可以剥离SQL并创建DBRM(基本上是一个特殊的SQL过程)。

It is the Bind that processes the DBRM (SQL) and creates DB2 access plans 绑定处理DBRM(SQL)并创建DB2访问计划


This may seem long winded after java etc. But there are some advantages 在Java等之后,这似乎有些困难。但是有一些优点

  • The SQL is processed ahead of time and not while the program is running SQL是提前处理的,而不是在程序运行时处理的
  • You can check the DB2 access path at any time - Before / after execution. 您可以随时检查DB2访问路径-执行之前/之后。 Useful for analysing performance issues. 对于分析性能问题很有用。
  • The same DB2 access paths are used from one run to the next. 从一次运行到下一次使用相同的DB2访问路径。 This leads to fairly predictable run times. 这导致相当可预测的运行时间。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM