Problem with JDBC: no suitable driver

From: "Konstantinos Spyropoulos" <el97010(at)mail(dot)ntua(dot)gr>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Problem with JDBC: no suitable driver
Date: 2002-06-26 22:15:00
Message-ID: 002101c21d5e$ea187d40$e1df6693@s
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello!
I'm having a problem with the JDBC driver: I am getting the "no suitable driver" exception
when I try to log on to the database through a simple java program.

I have postgresql 7.2.1 running in Win98, with Cygwin. The database was downloaded
and installed through the Cygwin setup. The JDBC driver I use is the one that comes with
Cygwin. Java is installed in windows in d:Programming/j2sdk1.4.0
The postmaster is initiated with the parameter -i and in case it matters I have the ipc-daemon running.

My variables are:
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:.:/home/inigo:/cygdrive/c/WINDOWS:/cygdrive/c/W
INDOWS/COMMAND:/cygdrive/d/PROGRAMMING/J2SDK1.4.0/BIN
$ echo $CLASSPATH
/usr/share/postgresql/java/postgresql.jar:/cygdrive/d/PROGRAMMING/J2SDK1.4.0/LIB

When I try to run the program below, I get the exception:
$ java test
org.postgresql.Driver
While connecting: No suitable driver

I even tried to run the program, removing the Class.forName line, giving the JDBC drivers
in command line, but the result was the same.
Sorry for the big mail, but I'm new to Postgres, JDBC and Cygwin, and at a loss.

Thank you all.

Here is the code of my program. (That program used to work in Postgres when I had Linux.)

import java.sql.*;

public class test {
public static void main(String args[]) {
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
}
try {
Connection db = DriverManager.getConnection("jdbc:postgresql://localhost:5432/inigo", "inigo", null);
} catch(SQLException e) {
System.out.println("while connecting: " + e.getMessage());
}
}
}

Browse pgsql-jdbc by date

  From Date Subject
Next Message Robert Treat 2002-06-26 23:11:06 DBVisualizer Null Pointer Exception
Previous Message Daryl Beattie 2002-06-26 21:18:16 Re: JDBC + PL/pgSQL ?