This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes JDBC and the fly likes Problem in connecting to DB2 using JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem in connecting to DB2 using JDBC" Watch "Problem in connecting to DB2 using JDBC" New topic

Problem in connecting to DB2 using JDBC

sirisha alam

Joined: Dec 17, 2002
Posts: 13
I am trying to connect to DB2 database from java and am getting the fllowing error.
I have set the required classpath. And here is the code that i am trying to use:
import java.sql.*;
public class SingleDBConnect
static SingleDBConnect dbConnection = null;
private Connection con = null;

private SingleDBConnect()
con = DriverManager.getConnection("jdbc b2:univ", "db2admin", "db2admin");
catch(ClassNotFoundException ex)
System.out.println("Exception in SingleDBConnect : " + ex);
catch(SQLException ex)
System.out.println("SQLException : " + ex);
public static Connection getConnection()
if( dbConnection == null )
dbConnection = new SingleDBConnect();
return dbConnection.con;
Please advise me on this.
Jan Modaal

Joined: Apr 06, 2004
Posts: 4
what happens if you place on top:
I agree. Here's the link:
subject: Problem in connecting to DB2 using JDBC