Re: java.lang.ClassNotFoundException loading JDBC driver - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: java.lang.ClassNotFoundException loading JDBC driver
Date
Msg-id 1044893985.1028.126.camel@inspiron.cramers
Whole thread Raw
In response to java.lang.ClassNotFoundException loading JDBC driver  (Ernst Jan Plugge <rmc@dds.nl>)
Responses Re: java.lang.ClassNotFoundException loading JDBC driver
List pgsql-jdbc
Ernst,

try running with java -d to show debugging information, it will show you
the classpath it is using

Dave
On Sun, 2003-02-09 at 16:27, Ernst Jan Plugge wrote:
> Hi,
>
>
> Ik know this is a FAQ, but this looks different.
>
> While loading the pgsql jdbc driver (using Class.forName() as the
> documentation suggests) I get a ClassNotFoundException:
>
> Exception in thread "main" java.lang.ClassNotFoundException:
> org.postgresql.Driver
>
> even though the JAR file _is_ on my classpath. I've tried both the
> CLASSPATH environment variable, and the -cp command line argument. The
> test app I use is extremely bare bones, uses nothing beyond JDBC, and only
> tries to load the driver and establish a connection.
>
> If I try to execute the class org.postgresql.Driver directly, with the
> same classpath specification, the class is found, and I get (as expected)
> an error message saying the class has no main method. This suggests that
> my classpath is okay.
>
> If I move the JAR file into the JVM's lib/ext directory, things work
> perfectly. I need to be able to use the driver without doing that,
> however. What am I doing wrong?
>
> I'm using the pg73jdbc3.jar from jdbc.postgresql.org, downloaded today.
> My JVM is j2sdk1.4.1_01 from Sun, on Red Hat Linux 8.0
>
> I also tried the 7.2, 7.1 and 7.0 drivers, and JVM jdk1.3.1_06 from Sun.
> (I used pg73jdbc2.jar instead of pg73jdbc3.jar there)
>
> My test app is very simple:
>
> import java.sql.*;
>
> public class TestApp
> {
>   public static void main( String argv[] ) throws
>     java.sql.SQLException, java.lang.ClassNotFoundException
>   {
>     Class.forName( "org.postgresql.Driver" );
>     String url = "jdbc:postgresql://dbhost:5432/test";
>     Connection conn = DriverManager.getConnection( url, "test", "xxxxxxxx" );
>   }
> }
>
>
> Ernst Jan
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
--
Dave Cramer <Dave@micro-automation.net>


pgsql-jdbc by date:

Previous
From: Jeremiah Jahn
Date:
Subject: Re: PreparedStatement.executeBatch() error? 7.3
Next
From: Barry Lind
Date:
Subject: Re: PreparedStatement.executeBatch() error? 7.3