• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

connecting to db2 using net driver

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wrote a program to connect to a db2 database on a system named Niranjan and database name is SAMPLE.
the program is
import java.sql.*;
import java.io.*;

public class netdb {

public static void main(String s[]) {
String db="SAMPLE";
String user="db2admin";
String pass="db2admin";
String conn = "jdbc:db2://NIRANJAN:3456/SAMPLE";
try{
Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");
Connection Conn = DriverManager.getConnection (conn,user,pass);
System.out.println("Connection uccess");
Statement SQLStatement = Conn.createStatement();
String Query ="SELECT * FROM EMPLOYEE";
ResultSet SQLResult = SQLStatement.executeQuery(Query);
while(SQLResult.next()) {
System.out.println(SQLResult.getString(1));
}
} catch(Exception e) {
System.out.println(e);
}
}

}
This program is giving an error
"COM.ibm.db2.jdbc.net.DB2Exception: [IBM][JDBC Driver] CLI0616E Error opening socket. SQLSTATE=08S01"
Plese Help me to get rid of this problem..
Niranjan

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Instead of using "NIRANJAN" in the URL I would try using the IP address instead.
String conn = "jdbc:db2://NIRANJAN:3456/SAMPLE";
Julio Lopez
M-Group Systems
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by niranjan pulipati:
I wrote a program to connect to a db2 database on a system named Niranjan and database name is SAMPLE.
the program is
import java.sql.*;
import java.io.*;

public class netdb {

public static void main(String s[]) {
String db="SAMPLE";
String user="db2admin";
String pass="db2admin";
String conn = "jdbc:db2://NIRANJAN:3456/SAMPLE";
try{
Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");
Connection Conn = DriverManager.getConnection (conn,user,pass);
System.out.println("Connection uccess");
Statement SQLStatement = Conn.createStatement();
String Query ="SELECT * FROM EMPLOYEE";
ResultSet SQLResult = SQLStatement.executeQuery(Query);
while(SQLResult.next()) {
System.out.println(SQLResult.getString(1));
}
} catch(Exception e) {
System.out.println(e);
}
}

}
This program is giving an error
"COM.ibm.db2.jdbc.net.DB2Exception: [IBM][JDBC Driver] CLI0616E Error opening socket. SQLSTATE=08S01"
Plese Help me to get rid of this problem..
Niranjan


 
sach rao
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is your Database instance started or Is it listening at port no 3456 ?
Sach

Originally posted by Julio Lopez:
Instead of using "NIRANJAN" in the URL I would try using the IP address instead.
String conn = "jdbc:db2://NIRANJAN:3456/SAMPLE";
Julio Lopez
M-Group Systems


 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am facing exactly the same problem here. Could you please tell me how to overcome this if you did?

Thanks,
Sadaf
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am getting the following error when trying to connect to DB2.

COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0615E Error receiving from socket, server is not responding. SQLSTATE=08S01


the code is :
Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");
Connection con =
DriverManager.getConnection(
"jdbc b2://INIDCP01BDC01:50000/GRPSREF",
"db2adminla",
"db2adminla");


Any idea what the possible problem could actually be ?


Thanks
[ April 29, 2005: Message edited by: Priya Dhir ]
reply
    Bookmark Topic Watch Topic
  • New Topic