This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes jdbc access to DB2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc access to DB2 " Watch "jdbc access to DB2 " New topic
Author

jdbc access to DB2

yogendra babu
Greenhorn

Joined: Jul 01, 2002
Posts: 17
I tried to access db2 personal edition in a remote Win2000 machine using JDBC(net driver).
The sample code is below
Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");
java.sql.Connection ocon=DriverManager.getConnection("jdbc b2:me2k1:JMXDB","userid","password");
System.out.println(ocon);
me2k1 is the machine name and jmxdb is the database name.
The above code throws below exception
COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0616E Error opening socket
. SQLSTATE=08S01.
All the DB2 services are running in db machine.
Should I specify the port number in the URL.If so how to find the port number of the database.
The same program runs perfectly in the machine where DB2 resides.
Thanks in advance for help
yogendra babu
Greenhorn

Joined: Jul 01, 2002
Posts: 17
Hai all,
The connection is working now.
I replaced the machine name with ip address.now it is working.Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: jdbc access to DB2
 
Similar Threads
java.sql.SQLException: No suitable driver
Problem in JDBC connection in Websphere 3.5.0
cannot connect to database
Error while starting Persistence Name Server !
Cannot start Persistent Name Server using jdbc:odbc