签到成功

知道了

CNDBA社区CNDBA社区

SQL1159 rc=10 when running a DB2 .NET application

2022-07-05 15:25 2293 0 原创 DB2
作者: hbhe0316

Troubleshooting

Problem
A DB2 .NET application may receive an exception as follows: SQL1159 Initialization error with DB2 .NET Data Provider, reason code 10, tokens 0.0.0, 9.5.3

Cause
An SQL1159 error may be returned if the DB2 .NET data provider had a problem during initialization.http://www.cndba.cn/hbhe0316/article/108524

When the DB2 .NET data provider is initialized it will perform some checks to ensure that the DB2 .NET data provider can be used properly. One of those checks is to see if it can execute a function from within the DB2 native client library called db2app.dll, and before that can be done it tries to load the db2app.dll library in memory.

Several different reason codes can be returned with the SQL1159 exception, but reason code 10 occurs when there is a mismatch between the DB2 native client library (db2app.dll) and the DB2 .NET data provider library (IBM.Data.DB2.dll).
SQL1159 reason code 10 will return two tokens. The first token is the version of the DB2 client library, and the second token is the version of the DB2 .NET data provider.

If the version of the DB2 client library is returned as 0.0.0, then that means that there was a problem during the initialization of the db2app.dll library.

There are potentially two reasons why a token of 0.0.0 is returned for the native DB2 client library.

http://www.cndba.cn/hbhe0316/article/108524

The first is that the db2app.dll is not compatible with the version of the DB2 client that is installed. The second is that there was a permission problem when trying to use the db2app.dll library with the application process.http://www.cndba.cn/hbhe0316/article/108524

http://www.cndba.cn/hbhe0316/article/108524

Resolving The Problem
Incompatible db2app.dll version
Every DB2 fixpak and release has its own version of the db2app.dll library. The file size and signature will be different for each fixpak and release. It is very important that when DB2 is installed that the db2app.dll library is the one that came from that level of DB2 that is being installed.http://www.cndba.cn/hbhe0316/article/108524

DB2 will update the db2app.dll library during the install of a fixpak or during the migration from one release to another. If there was a problem updating the db2app.dll, DB2 will document that in its installation log file.

Here is an example of a typical error in the DB2 install log when the db2app.dll could not be updated:

InstallFiles: File: db2app.dll, Directory: C:/Program Files/IBM/SQLLIB/BIN/, Size: 9680160

Info 1603.The file C:/Program Files/IBM/SQLLIB/BIN/db2app.dll is being held in use. Close that application and retry.
MSI (s) (CC:B0) [11:18:48:389]: Product: DB2 Connect Server - DB2COPY1. The file C:/Program Files/IBM/SQLLIB/BIN/db2app.dll is being held in use by the following process Name: msiexec , Id 5392.http://www.cndba.cn/hbhe0316/article/108524http://www.cndba.cn/hbhe0316/article/108524

If this was the case, then it is important that all applications were shut down before upgrading DB2. This includes any applications that run as Windows services, such as an application server that might be making DB2 connections. The above error is a result of an application holding a lock on the db2app.dll file, thus disallowing DB2 from updating the file.
To verify that the db2app.dll library is in fact compatible with the DB2 level, issue the db2level command, and then compare the level with the file version of the db2app.dll. To retrieve the file version, find the db2app.dll using Windows Explorer and right-click on it and go to Properties->Version.http://www.cndba.cn/hbhe0316/article/108524

http://www.cndba.cn/hbhe0316/article/108524

Invalid priviliges
When the db2app.dll library is initialized by the DB2 .NET data provider, it initializes an application environment. This process will ensure that the db2app.dll library can be used. Some of the things it does is it checks to see what DB2 environment variables are set, and it checks things like the client-side database manager configuration file. If the DB2 .NET data provider could not initialize the application environment properly then DB2 .NET will return 0.0.0 for the native DB2 client library version.

The most common reason why the initialization of the application environment fails is because of invalid privileges. And the most common reason why there are invalid privileges is if DB2 Extended Security is enabled, and the userid that the application process runs under is not a member of either the DB2ADMNS or the DB2USERS groups.

http://www.cndba.cn/hbhe0316/article/108524

版权声明:本文为博主原创文章,未经博主允许不得转载。

DB2

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
hbhe0316

hbhe0316

关注

1.只有承认无知,才能装下新的东西; 2.进步来自一点点滴滴的积累; 3.广博让你更优秀,而专业让你无法替代; 4.挫折和失败能够转换为一种财富。

  • 889
    原创
  • 1
    翻译
  • 13
    转载
  • 24
    评论
  • 访问:1040952次
  • 积分:1523
  • 等级:核心会员
  • 排名:第6名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ