Failed Connection (again)

From: Gonzo Programming <GonzoRock--at--Excite--dot--com(at)mta6(dot)snfc21(dot)pbi(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Failed Connection (again)
Date: 2001-06-08 17:03:12
Message-ID: 3.0.5.32.20010608100312.00a08c00@postoffice.pacbell.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Having HUGE troubles connecting to a pgDatabase. I have been struggling with this for 3 days now...

I Have scoured the docs, and this jdbc list archive without success. I would Love to find a mentor who might spend a bit of time getting me past this obstacle. Yes, I am new to java. :(

-----------
The Details,

1) I have pgSQL running on RedHat7.1 and have connected to it with pgAccess and created a few tables and populated them with some data.

2) I have installed pgAdmin on a NT machine on the network and accessed the data on the Linux machine described above.

3) I am developing a simple program on the NT machine and I have copied some example code from a JavaTutorial and compiled and made it work to access a MSAccess db locally on the on the NT machine running JDK1.3

4.) I have read the Docs written by Peter Mount and have modified the code in what seem reasoable ways to access the pgDatabase ...all to no avail.

4a) I have renamed jdb7.0-1.1.jar to postgresql.jar and then copied that .jar file into as many places as seems reasonable and not so reasonable(yes I have copies all over the place at present), yet still get this error at run time.

H:\JavaLessons\ch18\fig18_24>java TableDisplayPG1
Failed to load JDBC/ODBC driver.
java.lang.ClassNotFoundException: org.postgresql.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
and about 10 more lines of errors...

--------

Is there someone with a big heart and brain who would spend some time helping me get this working... I suspect once I do I'll be sailing(yeah right). Maybe set up and instant message chat or something to work it through... The source code is below. Thanks to whom ever has some time.

Gonzo feeling like a bozo!

-----------
Source code
*************
// This works
*************
// The URL specifying the Books database to which
// this program connects using JDBC to connect to a
// Microsoft ODBC database.
String url = "jdbc:odbc:Books";
String username = "anonymous";
String password = "guest";

*************
// This DOES NOT work!!
*************
// The URL specifying the test database to which
// this program connects using JDBC to connect to a
// postgres database on the network somewhere.
String url = "jdbc://10.0.0.15:5432/test";
String username = "postgres";
String password = "";

*************
// This works
*************
// Load the driver to allow connection to the database
try {
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
connection = DriverManager.getConnection(
url, username, password );
}
catch ( ClassNotFoundException cnfex ) {
System.err.println(
"Failed to load JDBC/ODBC driver." );
cnfex.printStackTrace();
System.exit( 1 ); // terminate program
*************
// This DOES NOT work!
*************
// Load the driver to allow connection to the database
try {
Class.forName("org.postgresql.Driver");
connection = DriverManager.getConnection(
url, username, password );
}

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2001-06-08 17:45:48 Re: unlink large objects
Previous Message Philip Crotwell 2001-06-08 14:55:45 unlink large objects