wood burning stoves 2.0*
The moose likes JDBC and the fly likes Java-DB2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Java-DB2" Watch "Java-DB2" New topic


Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
Hi Friends,
I've written a simple JDBC program with the intension of connecting to DB2 7.02.I've craeted a table in DB and want my JDBC program shown below to connect it.I'm getting the following error.please help me to sort and understand it better.
import java.util.Hashtable;
import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;

public class JDBCConnectionFromClient {
static java.sql.Connection con;
* Constructor for JDBCConnectionFromClient.
public JDBCConnectionFromClient() {

static {
try {
} catch (Exception e) {

public static void main(String[] args) {
try {
Connection con = DriverManager.getConnection("jdbc b2 RASHDB");
}catch(Exception ex) {

Error i got is:
java.lang.ClassNotFoundException: COM.ibm.db2.jdbc.app.DB2Driver
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:563)
at java.sql.DriverManager.getConnection(DriverManager.java:216)
at ClientPrograms.JDBCConnectionFromClient.main( JDBCConnectionFromClient.java:43)

Thanks in adavnce
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
You must have the driver class in your classpath.
this file is db2java.zip and its location on windows is

put it in your classpath and it should be OK.

SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
I agree. Here's the link: http://aspose.com/file-tools
subject: Java-DB2
Similar Threads
No suitable Driver in DB2
java.sql.SQLException: No suitable driver in DB2 7.01
Problem in JDBC connection in Websphere 3.5.0
java.sql.SQLException: No suitable driver
Data source name not found and no default driver specified