com.ibm.db2.jcc.am.SqlException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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.
    via by Adam Swartz,
  • How to make Spark JDBC driver show full exception?
    via Stack Overflow by iru
    ,
    • 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)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,