Thread: I am totally lost
JDBC users
I want to use jdbc on a Windows/Cygwin machine, and my Postgress is sitting on a different Linux box setup from the RH7.3 install.
I go to the PostgresSQL JDBC Drivers, and download the latest stable release which is pgjdbc2.jar. No where on the website is the term pgjdbc2.jar mentioned, all the documentation refers to postgresql.jar. Regardless, I set up the class path to include pgjdbc2.jar.
And I write the following code:
// PostgressTest.java
import java.sql.*;
public class PostgressTest
{
public static void main (String [] args)
{
System.out.println ("PostgressTest");
System.out.println ("before loading drivers");
try
{
Class.forName ("org.postgresql.Driver");
}
catch (Exception x)
{
System.err.println (x.toString ());
}
System.out.println ("after loading drivers");
}
}
{
public static void main (String [] args)
{
System.out.println ("PostgressTest");
System.out.println ("before loading drivers");
try
{
Class.forName ("org.postgresql.Driver");
}
catch (Exception x)
{
System.err.println (x.toString ());
}
System.out.println ("after loading drivers");
}
}
It fails at run time like so ...
PostgressTest
before loading drivers
java.lang.ClassNotFoundException: org.postgresql.Driver
after loading drivers
before loading drivers
java.lang.ClassNotFoundException: org.postgresql.Driver
after loading drivers
What is postgresql.jar, and what have I done wrong in this installation. I am so confused.
Julian Brown
I am embarrassed, thanx Joe, I have a mixed mode computer here, I am running in Cygwin and Java is running in normal Win32 mode. As a result I had the wrong syntax in my CLASSPATH variable
I had it say
CLASSPATH=/home/julian/Java/JDBC/pgjdbc2.jar
which is correct for cygwin, but Java is installed into Windows so
It should have said
CLASSPATH=D:/cygwin/home/julian/Java/JDBC/pgjdbc2.jar
Thanx all
Sorry for the inconvenience.
Julian
----- Original Message -----From: SHEVLAND, JoeTo: 'Julian Brown'Sent: Tuesday, October 08, 2002 6:30 PMSubject: RE: [JDBC] I am totally lostIt doesn't matter what the JAR file name is, as long as its included correctly in the CLASSPATH environment variable or via the command line. Make sure its a valid JAR file by opening it with WinZip or a similar tool, you should be able to see the directory hierarchy org/postgresql/...What does your CLASSPATH env variable look like? Try specifying an absolute path to make sure its picking it up correctly, or make sure that if you're using a relative path to the JAR file that the java app is in the correct working directory when it starts.Cheers,Joe-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Julian Brown
Sent: Wednesday, 9 October 2002 9:17
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] I am totally lostJDBC usersI want to use jdbc on a Windows/Cygwin machine, and my Postgress is sitting on a different Linux box setup from the RH7.3 install.I go to the PostgresSQL JDBC Drivers, and download the latest stable release which is pgjdbc2.jar. No where on the website is the term pgjdbc2.jar mentioned, all the documentation refers to postgresql.jar. Regardless, I set up the class path to include pgjdbc2.jar.And I write the following code:// PostgressTest.javaimport java.sql.*;public class PostgressTest
{
public static void main (String [] args)
{
System.out.println ("PostgressTest");
System.out.println ("before loading drivers");
try
{
Class.forName ("org.postgresql.Driver");
}
catch (Exception x)
{
System.err.println (x.toString ());
}
System.out.println ("after loading drivers");
}
}It fails at run time like so ...PostgressTest
before loading drivers
java.lang.ClassNotFoundException: org.postgresql.Driver
after loading driversWhat is postgresql.jar, and what have I done wrong in this installation. I am so confused.Julian Brown