If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Problems withd DB2 and Java 1.2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-22-07, 17:00
IvanJ2EE IvanJ2EE is offline
Registered User
 
Join Date: Jun 2007
Location: Mexico City
Posts: 2
Question Problems withd DB2 and Java 1.2

Hello partners.
I have some troubles trying to connect to a remote database in DB2, Version 8.2, from a Java Class.

I`m using the following code:

Code:
    String DRIVER = "COM.ibm.db2.jdbc.app.DB2Driver";

    String URL = "jdbc:db2://200.33.154.10:50200/BAFBP001";
         try
         {
            Class.forName(DRIVER);
             }
         catch(Exception ex)
         {
            System.out.println("Error");
         }
      //more code
      .
      .
           Connection con = DriverManager.getConnection(URL,"dbjj","dbjjk002");
       
      //more code
The problem is that the program can find the driver, but in the moment that tries to find the DB, I got a SQL exception: "No suitable Driver"

The driver used is DB2Java.zip. I tried with db2jcc.jar and the license driver and it worked perfectly in my local host and local server, but I found that those drivers are not compatible with the JDK 1.2, used by the Websphere 3.5, and I got the horrible "Major minor exception". The big deal is that I need to make it work on that old Websphere.

The weird thing that I found is that when I try to contact the Database using Eclipse or my DB2 Client, I can do it without any problems, using the same IP, Port and DataBase name.

I hope I explain myself well. If any of you have some suggests or solutions, are well received. Or if you have an old DB2 driver for jdk 1.2, you will save my life.

Thank you all.

Last edited by IvanJ2EE; 06-22-07 at 17:20.
Reply With Quote
  #2 (permalink)  
Old 06-22-07, 20:34
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
That's not a correct URL for the app driver. You will need to catalog the database:
Code:
db2 catalog tcpip node mynode remote 200.33.154.10 server 50200
db2 catalog database BAFBP001 at node mynode
and use the cataloged name in the URL:
Code:
...
String URL = "jdbc:db2:BAFBP001";
...
Reply With Quote
  #3 (permalink)  
Old 06-25-07, 12:04
IvanJ2EE IvanJ2EE is offline
Registered User
 
Join Date: Jun 2007
Location: Mexico City
Posts: 2
Smile Thank you

My friend thank u very much, that`s what I call an excellent solution.
Thank you so much, you just saved my life...

God Bless GURU´S like u

See ya
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On