com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.19.26] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: no db2jcct2 in java.library.path: ERRORCODE=-4472, SQLSTATE=null

Pentaho BI Platform Tracking | Adam Swartz | 7 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    A type 2 driver uses native code to connect to the database without a password when connecting on the local server. This is useful for deployments as it does not expose the password or require password management through another tool. I suggest modifying the getURL call to the following: public String getURL( String hostname, String port, String databaseName ) { if ( getAccessType() == DatabaseMeta.TYPE_ACCESS_ODBC ) { return "jdbc:odbc:" + databaseName; } else { // if we are running on the local host then try to use the // native type 2 driver, else use a type 4. // type 2 drivers can connect without user credentials. String localhost = ""; String fullhost = ""; try { localhost = InetAddress.getLocalHost().getHostName(); fullhost = InetAddress.getLocalHost().getCanonicalHostName(); } catch (UnknownHostException e) { } if (hostname != null && ( hostname.trim().length() == 0 || hostname.equals("localhost") || hostname.equals(localhost) || hostname.equals(fullhost))) return "jdbc:db2:" + databaseName; else return "jdbc:db2://" + hostname + ":" + port + "/" + databaseName; } } I have tested this locally and the type 2 connection works. You do however have to address the use of java.library.path in spoon.sh so it can load the JNDI, but I opened another defect for that. Without that you would get: com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.19.26] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: no db2jcct2 in java.library.path: ERRORCODE=-4472, SQLSTATE=null at com.ibm.db2.jcc.am.kd.a(Unknown Source) at com.ibm.db2.jcc.am.kd.a(Unknown Source) at com.ibm.db2.jcc.am.kd.a(Unknown Source) at com.ibm.db2.jcc.t2.a.a(Unknown Source) at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(Unknown Source) at com.ibm.db2.jcc.DB2Driver.connect(Unknown Source) at com.ibm.db2.jcc.DB2Driver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:664) I still suggest doing this change apart from that as it is easy to manage spoon.sh vs managing a java class change.

    Pentaho BI Platform Tracking | 7 months ago | Adam Swartz
    com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.19.26] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: no db2jcct2 in java.library.path: ERRORCODE=-4472, SQLSTATE=null
  2. 0

    Hibernate connecting to DB2 at application startup on WAS Liberty on CICS

    Stack Overflow | 7 months ago | Gediminas Rimsa
    com.ibm.db2.jcc.am.SqlException: [jcc][50053][12310][4.19.56] T2zOS exception: [jcc][T2zos]T2zosCicsApi.checkApiStatus: Thread is not CICS-DB2 compatible: CICS_REGION_BUT_API_DISALLOWED ERRORCODE=-4228, SQLSTATE=null

    Root Cause Analysis

    1. com.ibm.db2.jcc.am.SqlException

      [jcc][10389][12245][4.19.26] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: no db2jcct2 in java.library.path: ERRORCODE=-4472, SQLSTATE=null

      at com.ibm.db2.jcc.am.kd.a()
    2. IBM DB2
      kd.a
      1. com.ibm.db2.jcc.am.kd.a(Unknown Source)
      2. com.ibm.db2.jcc.am.kd.a(Unknown Source)
      3. com.ibm.db2.jcc.am.kd.a(Unknown Source)
      3 frames
    3. com.ibm.db2
      DB2Driver.connect
      1. com.ibm.db2.jcc.t2.a.a(Unknown Source)
      2. com.ibm.db2.jcc.t2.T2Configuration.<clinit>(Unknown Source)
      3. com.ibm.db2.jcc.DB2Driver.connect(Unknown Source)
      4. com.ibm.db2.jcc.DB2Driver.connect(Unknown Source)
      4 frames
    4. Java RT
      DriverManager.getConnection
      1. java.sql.DriverManager.getConnection(DriverManager.java:664)
      1 frame