Connect with Java to Linux DB2

Ask a Question related to IBM DB2, Design and Development.

  1. #1

    Default Connect with Java to Linux DB2

    Hello,

    i want to connect with a java program to a db2 8.1 database.
    both running on the same linux maschine.
    that combination functioned on a windows 2000 pc before.
    now i get the following error:

    java.sql.SQLException: java.lang.UnsatisfiedLinkError: no db2jdbc in
    java.library.path
    at COM.ibm.db2.jdbc.app.DB2Driver.<init>(Unknown Source)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native
    Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Construc tor.java:274)
    at java.lang.Class.newInstance0(Class.java:306)
    at java.lang.Class.newInstance(Class.java:259)


    setting different enviroment variables in the program ...

    System.setProperty("DB2_JDBC_DRIVER_PATH","/home/db2inst1/sqllib/java"); System.setProperty("DB2TEMPDIR","/home/db2inst1/sqllib"); System.setProperty("INCLUDE","/home/db2inst1/sqllib/INCLUDE:/home/db2inst1/sqllib/lib");
    System.setProperty("LIB","/home/db2inst1/sqllib/lib"); System.setProperty("java.library.path","/opt/IBM/db2/V8.1/lib"); System.out.println(System.getProperty("DB2_JDBC_DR IVER_PATH")); System.out.println(System.getProperty("java.librar y.path"));

    .... results that error:

    /home/db2inst1/sqllib/java
    /opt/IBM/db2/V8.1/lib
    java.sql.SQLException: java.lang.UnsatisfiedLinkError: Can't find
    library db2jdbc (libdb2jdbc.so) in java.library.path
    java.library.path=/opt/IBM/db2/V8.1/lib
    at COM.ibm.db2.jdbc.app.DB2Driver.<init>(Unknown Source)
    at java.lang.Class.newInstance0(Native Method)
    at java.lang.Class.newInstance(Class.java:262)
    at os400tolinux.daten.<init>(daten.java:42)
    at os400tolinux.daten.main(daten.java:58)

    someone able to tell me what to do to get it work?
    thx
    pico77 Guest

  2. Similar Questions and Discussions

    1. Remote Java Web Service over HTTPS - How to Connect?
      Hi all, I am using Coldfusion MX 6.1 to develop a web service client that has to connect to a remote Java web service over HTTPS (SSL over HTTP)....
    2. Using Java CFX on Linux
      Just wanted to post a note to say thanks! Your info was VERY helpful. I appreciate it. Cheers, Craig
    3. Cannot connect to SQL 2k from MX7 (Linux)
      Can someone confirm|deny that MX7 JDBC drivers fail to connect to a SQL 2k *SP4* server when the "force protocol encryption" is enabled? Same is...
    4. Warning: SQL procedures/Java/8.1.2 on Linux
      Hello all, I'm writing this as a warning to others. We installed DB2 8.1.2 with all fixpaks onto our Linux server with the intention of moving our...
    5. Error when I try to connect to DB2 from JAVA
      Hi, I am trying to connect to DB2 database from JAVA. This is following piece of code i am using to connect to DB2 database ...
  3. #2

    Default Re: Connect with Java to Linux DB2

    pico77 wrote:
    > Hello,
    >
    > i want to connect with a java program to a db2 8.1 database.
    > both running on the same linux maschine.
    > that combination functioned on a windows 2000 pc before.
    > now i get the following error:
    >
    > java.sql.SQLException: java.lang.UnsatisfiedLinkError: no db2jdbc in
    > java.library.path
    > at COM.ibm.db2.jdbc.app.DB2Driver.<init>(Unknown Source)
    > at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native
    > Method)
    > at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
    > at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
    > at java.lang.reflect.Constructor.newInstance(Construc tor.java:274)
    > at java.lang.Class.newInstance0(Class.java:306)
    > at java.lang.Class.newInstance(Class.java:259)
    >
    >
    > setting different enviroment variables in the program ...
    >
    > System.setProperty("DB2_JDBC_DRIVER_PATH","/home/db2inst1/sqllib/java"); System.setProperty("DB2TEMPDIR","/home/db2inst1/sqllib"); System.setProperty("INCLUDE","/home/db2inst1/sqllib/INCLUDE:/home/db2inst1/sqllib/lib");
    > System.setProperty("LIB","/home/db2inst1/sqllib/lib"); System.setProperty("java.library.path","/opt/IBM/db2/V8.1/lib"); System.out.println(System.getProperty("DB2_JDBC_DR IVER_PATH")); System.out.println(System.getProperty("java.librar y.path"));
    >
    > ... results that error:
    >
    > /home/db2inst1/sqllib/java
    > /opt/IBM/db2/V8.1/lib
    > java.sql.SQLException: java.lang.UnsatisfiedLinkError: Can't find
    > library db2jdbc (libdb2jdbc.so) in java.library.path
    > java.library.path=/opt/IBM/db2/V8.1/lib
    > at COM.ibm.db2.jdbc.app.DB2Driver.<init>(Unknown Source)
    > at java.lang.Class.newInstance0(Native Method)
    > at java.lang.Class.newInstance(Class.java:262)
    > at os400tolinux.daten.<init>(daten.java:42)
    > at os400tolinux.daten.main(daten.java:58)
    >
    > someone able to tell me what to do to get it work?
    > thx
    Run db2profile under sqllib directory. It will setup the load path for you.

    W Gemini Guest

  4. #3

    Default Re: Connect with Java to Linux DB2

    Connect with Java to Linux DB2
    RANJNi Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139