Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2004
    Posts
    7

    Unanswered: connection problems to db2 8.1 using jdbc

    hi,
    i am trying to connect to a db2 server in school(db2 8.1) running on linux from my home pc(windows xp) i have installed the app/dev client. i use the following code in my java program to connect

    String url = "jdbc:db2://remote host:50000/dbname";
    Class.forName("com.ibm.db2.jcc.DB2Driver");
    con = DriverManager.getConnection(url, user, password);

    i get the following error

    com.ibm.db2.jcc.b.SQLException: IO Exception opening socket to server "remote host" on port 50000. The DB2 Server may be down.
    at com.ibm.db2.jcc.a.a.<init>(a.java:110)
    at com.ibm.db2.jcc.a.b.a(b.java:1110)
    at com.ibm.db2.jcc.b.l.<init>(l.java:274)
    at com.ibm.db2.jcc.a.b.<init>(b.java:204)
    at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:2 44)
    at java.sql.DriverManager.getConnection(DriverManager .java:512)
    at java.sql.DriverManager.getConnection(DriverManager .java:171)
    at joyousconnect.main(joyousconnect.java:16)

    i have also not been able catlog the remote db using the clients config assistant. it gives me a simillar kind of error. i am not behind a fire wall. does anyone know what iam doing wrong?
    thanks

    maulin
    Last edited by maulin; 06-23-04 at 00:57.

  2. #2
    Join Date
    Dec 2003
    Posts
    51

    Please check out this !!!

    Use this code to get the connection
    Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");
    dbconn = DriverManager.getConnection("jdbc:db2://ipaddress:6789/sample","username","password");

  3. #3
    Join Date
    Jun 2004
    Posts
    7
    hi,
    thanks. i tried what you suggested and ran db2jstrt 6789 to make sure that it was the right port but now i get a different kind of error

    COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0616E Error opening socket. SQLSTATE=08S01
    at COM.ibm.db2.jdbc.net.SQLExceptionGenerator.socketE xception(Unknown Source)
    at COM.ibm.db2.jdbc.net.DB2Connection.create(Unknown Source)
    at COM.ibm.db2.jdbc.net.DB2Connection.<init>(Unknown Source)
    at COM.ibm.db2.jdbc.net.DB2Driver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(DriverManager .java:512)
    at java.sql.DriverManager.getConnection(DriverManager .java:171)
    at joyousconnect.main(joyousconnect.java:16)

    i am completely clueless...

    maulin

  4. #4
    Join Date
    Dec 2003
    Posts
    51
    Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");
    dbconn = DriverManager.getConnection("jdbc:db2://ipaddress:6789/databasename","username","password");


    then extend the classpath to db2java.zip .

    it will work ..

  5. #5
    Join Date
    Jun 2004
    Posts
    7
    iam pretty new to all this, sorry. iam using jcreator and it somehow gives me an error about class not found even tho its in the class path, so i extracted all the files from db2java.zip and imported the required class
    import com.ibm.db2.jdbc.*; that seems to work but i still get the same error.

Posting Permissions

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