Failure in loading native library db2jcct2, UnsatisfiedLinkError: ERRORCODE=-4472

Original link: http://www-01.ibm.com/support/docview.wss?uid=swg21419978


Failure in loading native library db2jcct2, UnsatisfiedLinkError: ERRORCODE=-4472

Technote (troubleshooting)


Problem(Abstract)

Java application failing with UnsatisfiedLinkError, resulting in the failure to load native DB2 library (db2jcct2) for establishing a type 2 connection.

Symptom

Applications failing to load the Data Server Driver for a Type 2 connection may return one of the following messages:


  • [jcc][10389][12245][3.53.70] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: db2jcct2 (No such file or directory): ERRORCODE=-4472, SQLSTATE=null

    [jcc][10389][12245][3.57.110] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: Can't find library db2jcct2 (libdb2jcct2.so or .so)  ERRORCODE=-4472


Cause

The application environment is not configured correctly for loading the DB2 native library.

Resolving the problem

The IBM® Data Server Driver for JDBC and SQLJ supports two types of connectivity: type 2 connectivity and type 4 connectivity.


Type 2 connectivity requires a DB2 client (or server) installation and has a restriction in that the "bitness" of the java application must match with the DB2 client ( or server) instance.

So a 32bit java application using type 2 connectivity can only work with a 32bit DB2 client (or server) instance and a 64bit java application using type 2 connectivity can only work with a 64bit DB2 client (or server) instance for connectivity to a remote (or local) database. The bitnes of the remote database instance does not matter, only that of which is configured in the client application environment.

Example, if install the IBM Data Server Driver for JDBC and SQLJ on a Windows 64-bit operating system then one cannot use IBM Data Server Driver for JDBC and SQLJ type 2 connectivity to connect to a DB2 Database for Linux, UNIX, and Windows instance from a 32-bit Java application.

If the above requirement has been met and yet continue failing at loading the native db2 library then check that library path is being set correctly.

The JVM used for the application environment must load the correct library, depending on its bit type (32-bit or 64-bit). A 32-bit JVM can only load the 32-bit DB2 native libraries and a 64-bit JVM can only load the 64-bit DB2 native libraries.

  • Windows:
    Ensure LIB environment variable references the correct library path for the JVM.

    • db2jcct2.dll is located in %DB2HOME%\bin

      Associated libraries (*.lib) are located in:
      • (32-bit) %DB2HOME%\lib\Win32.
        (64-bit) %DB2HOME%\lib

    Unix and Linux:
    Ensure LIBPATH (AIX) or LD_LIBRARY_PATH (Linux/Unix) references the correct library path.

    • libdb2jcct2.so is located in:
      • (32-bit) INSTHOME/sqllib/lib32
        (64-bit)   INSTHOME/sqllib/lib64


As a workaround when unable to meet the above requirements, consider upgrading the application to use a Type 4 (TCP/IP) JDBC connection. The Data Server Driver for Type 4 connection does nott require the use of the native DB2 libraries.

If using the DriverManager interface, specify the type of connectivity through the URL.


If using the DataSource interface, specify the type of connectivity through the driverType property
The data type of this property is int. Valid values are 2 or 4.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值