Thread: pg73jdbc3.jar ClassNotFoundException

pg73jdbc3.jar ClassNotFoundException

From
"Shannon Scott"
Date:
Hello,
My apologies if this is a repeat question... I could not find my answer in the archives.
I am trying to connect to PostGreSQL through a JDBC connection.
I have set my classpath ( returned from set ):
CLASSPATH=/usr/java/j2sdk1.4.0/lib/tools.jar:.:/usr/java/j2sdk1.4.0/dt.jar:/usr/java/local/lib/pg73jdbc3.jar
 
but when I run my sample:
 
import java.sql.*;
 
public class TestConn
{
  public static void main( String argv[] ) throws
    java.sql.SQLException, java.lang.ClassNotFoundException
  {
    Class.forName( "org.postgresql.Driver" );
    String url = "jdbc:postgresql://test:5432/test";
    Connection conn = DriverManager.getConnection( url, "test", "testpass" );
  }
}
 
It throws the ClassNotFoundException.
I am using:
Redhat 8.0
PostGreSQL 7.2
J2SDK  1.4.0
 
I thought this ( pg73jdbc3.jar )  was the right version to use.
I'm sure I've missed something simple... any help is greatly appreciated.
I have successfully set up JDBC connections for Oracle and MySQL in the past without problems.
Thank You for any Help.
Shannon
 
 
 

Re: pg73jdbc3.jar ClassNotFoundException

From
Daniel Serodio
Date:
How are you invoking this sample app? If this is packed within a jar,
you need to pass -classpath as the CLASSPATH env var is ignored.

[]'s
Daniel Serodio

On Tue, 2003-02-18 at 17:45, Shannon Scott wrote:
> Hello,
> My apologies if this is a repeat question... I could not find my
> answer in the archives.
> I am trying to connect to PostGreSQL through a JDBC connection.
> I have set my classpath ( returned from set ):
> CLASSPATH=/usr/java/j2sdk1.4.0/lib/tools.jar:.:/usr/java/j2sdk1.4.0/dt.jar:/usr/java/local/lib/pg73jdbc3.jar
>
> but when I run my sample:
>
> import java.sql.*;
>
> public class TestConn
> {
>   public static void main( String argv[] ) throws
>     java.sql.SQLException, java.lang.ClassNotFoundException
>   {
>     Class.forName( "org.postgresql.Driver" );
>     String url = "jdbc:postgresql://test:5432/test";
>     Connection conn = DriverManager.getConnection( url, "test",
> "testpass" );
>   }
> }
>
> It throws the ClassNotFoundException.
> I am using:
> Redhat 8.0
> PostGreSQL 7.2
> J2SDK  1.4.0
>
> I thought this ( pg73jdbc3.jar )  was the right version to use.
> I'm sure I've missed something simple... any help is greatly
> appreciated.
> I have successfully set up JDBC connections for Oracle and MySQL in
> the past without problems.
> Thank You for any Help.
> Shannon
>
>
>
--
Daniel Serodio <daniel@checkforte.com.br>
CheckForte


Re: pg73jdbc3.jar ClassNotFoundException

From
"Shannon Scott"
Date:
Daniel,
Thank you for responding.
I compiled it into a class:
javac TestConn.java

Then tried to run it:
java TestConn

Do you know what I am doing wrong?
Thanks Again.
Shannon


----- Original Message -----
From: "Daniel Serodio" <daniel@checkforte.com.br>
To: "Shannon Scott" <sscott@gwi.net>
Cc: "PostgreSQL JDBC List" <pgsql-jdbc@postgresql.org>
Sent: Tuesday, February 18, 2003 3:59 PM
Subject: Re: [JDBC] pg73jdbc3.jar ClassNotFoundException


> How are you invoking this sample app? If this is packed within a jar,
> you need to pass -classpath as the CLASSPATH env var is ignored.
>
> []'s
> Daniel Serodio
>
> On Tue, 2003-02-18 at 17:45, Shannon Scott wrote:
> > Hello,
> > My apologies if this is a repeat question... I could not find my
> > answer in the archives.
> > I am trying to connect to PostGreSQL through a JDBC connection.
> > I have set my classpath ( returned from set ):
> >
CLASSPATH=/usr/java/j2sdk1.4.0/lib/tools.jar:.:/usr/java/j2sdk1.4.0/dt.jar:/
usr/java/local/lib/pg73jdbc3.jar
> >
> > but when I run my sample:
> >
> > import java.sql.*;
> >
> > public class TestConn
> > {
> >   public static void main( String argv[] ) throws
> >     java.sql.SQLException, java.lang.ClassNotFoundException
> >   {
> >     Class.forName( "org.postgresql.Driver" );
> >     String url = "jdbc:postgresql://test:5432/test";
> >     Connection conn = DriverManager.getConnection( url, "test",
> > "testpass" );
> >   }
> > }
> >
> > It throws the ClassNotFoundException.
> > I am using:
> > Redhat 8.0
> > PostGreSQL 7.2
> > J2SDK  1.4.0
> >
> > I thought this ( pg73jdbc3.jar )  was the right version to use.
> > I'm sure I've missed something simple... any help is greatly
> > appreciated.
> > I have successfully set up JDBC connections for Oracle and MySQL in
> > the past without problems.
> > Thank You for any Help.
> > Shannon
> >
> >
> >
> --
> Daniel Serodio <daniel@checkforte.com.br>
> CheckForte
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>


Re: pg73jdbc3.jar ClassNotFoundException

From
"Agrawal, Manish"
Date:

I am not sure if it applies to you but I had a similar problem in using pgsql and jdbc on windows. I found that the solution (in windows at least) is to save the jar file in <jdkhome>/jre/lib/ext

 

After placing the file correctly, I didn't have to worry about classpath.

 

Manish

_________________________________

Manish Agrawal

Asstt. Prof., Dept. of ISDS, Univ. of South Florida

4202 E. Fowler Ave., CIS 1040, Tampa, Fl 33620 - 7800

(813)-974-6716 (W) 974-6749 (FAX)

magrawal@coba.usf.edu

______________________________________

My default office suite is Openoffice, the simple-to-use, opensource Office Suite for Windows, Linux and Macs. http://www.openoffice.org

 

-----Original Message-----
From: Shannon Scott [mailto:sscott@gwi.net]
Sent: Tuesday, February 18, 2003 3:46 PM
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] pg73jdbc3.jar ClassNotFoundException

 

Hello,

My apologies if this is a repeat question... I could not find my answer in the archives.

I am trying to connect to PostGreSQL through a JDBC connection.

I have set my classpath ( returned from set ):

CLASSPATH=/usr/java/j2sdk1.4.0/lib/tools.jar:.:/usr/java/j2sdk1.4.0/dt.jar:/usr/java/local/lib/pg73jdbc3.jar

 

but when I run my sample:

 

import java.sql.*;

 

public class TestConn
{
  public static void main( String argv[] ) throws
    java.sql.SQLException, java.lang.ClassNotFoundException
  {
    Class.forName( "org.postgresql.Driver" );
    String url = "jdbc:postgresql://test:5432/test";
    Connection conn = DriverManager.getConnection( url, "test", "testpass" );
  }
}

 

It throws the ClassNotFoundException.

I am using:

Redhat 8.0

PostGreSQL 7.2

J2SDK  1.4.0

 

I thought this ( pg73jdbc3.jar )  was the right version to use.

I'm sure I've missed something simple... any help is greatly appreciated.

I have successfully set up JDBC connections for Oracle and MySQL in the past without problems.

Thank You for any Help.

Shannon

 

 

 

Re: pg73jdbc3.jar ClassNotFoundException

From
"Shannon Scott"
Date:
Thank you all for your help.
I tried the pg72jdbc2.jar instead, and the Driver can be found.
Take Care
Shannon
 
 
 
----- Original Message -----
Sent: Tuesday, February 18, 2003 4:46 PM
Subject: RE: [JDBC] pg73jdbc3.jar ClassNotFoundException

I am not sure if it applies to you but I had a similar problem in using pgsql and jdbc on windows. I found that the solution (in windows at least) is to save the jar file in <jdkhome>/jre/lib/ext

 

After placing the file correctly, I didn't have to worry about classpath.

 

Manish

_________________________________

Manish Agrawal

Asstt. Prof., Dept. of ISDS, Univ. of South Florida

4202 E. Fowler Ave., CIS 1040, Tampa, Fl 33620 - 7800

(813)-974-6716 (W) 974-6749 (FAX)

magrawal@coba.usf.edu

______________________________________

My default office suite is Openoffice, the simple-to-use, opensource Office Suite for Windows, Linux and Macs. http://www.openoffice.org

 

-----Original Message-----
From: Shannon Scott [mailto:sscott@gwi.net]
Sent: Tuesday, February 18, 2003 3:46 PM
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] pg73jdbc3.jar ClassNotFoundException

 

Hello,

My apologies if this is a repeat question... I could not find my answer in the archives.

I am trying to connect to PostGreSQL through a JDBC connection.

I have set my classpath ( returned from set ):

CLASSPATH=/usr/java/j2sdk1.4.0/lib/tools.jar:.:/usr/java/j2sdk1.4.0/dt.jar:/usr/java/local/lib/pg73jdbc3.jar

 

but when I run my sample:

 

import java.sql.*;

 

public class TestConn
{
  public static void main( String argv[] ) throws
    java.sql.SQLException, java.lang.ClassNotFoundException
  {
    Class.forName( "org.postgresql.Driver" );
    String url = "jdbc:postgresql://test:5432/test";
    Connection conn = DriverManager.getConnection( url, "test", "testpass" );
  }
}

 

It throws the ClassNotFoundException.

I am using:

Redhat 8.0

PostGreSQL 7.2

J2SDK  1.4.0

 

I thought this ( pg73jdbc3.jar )  was the right version to use.

I'm sure I've missed something simple... any help is greatly appreciated.

I have successfully set up JDBC connections for Oracle and MySQL in the past without problems.

Thank You for any Help.

Shannon

 

 

 

Re: pg73jdbc3.jar ClassNotFoundException

From
"Nick Fankhauser"
Date:
I'm glad to hear that it is working, but this doesn't seem likely to have
been the cause. The messages that you reported indicate that the driver
isn't being found at all, not that it is an incorrect version. I'd suggest
looking closely at whether the location of the driver or the classpath
changed during the same process.

-Nick



>Thank you all for your help.
>I tried the pg72jdbc2.jar instead, and the Driver can be found.