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 > connection problems to db2 8.1 using jdbc

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-22-04, 23:53
maulin maulin is offline
Registered User
 
Join Date: Jun 2004
Posts: 7
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-22-04 at 23:57.
Reply With Quote
  #2 (permalink)  
Old 06-23-04, 00:40
Pinto Pinto is offline
Registered User
 
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");
Reply With Quote
  #3 (permalink)  
Old 06-23-04, 02:15
maulin maulin is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 06-23-04, 02:36
Pinto Pinto is offline
Registered User
 
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 ..
Reply With Quote
  #5 (permalink)  
Old 06-23-04, 02:46
maulin maulin is offline
Registered User
 
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.
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