Re: Failed Connection (again)

From: Gonzo Programming <GonzoRock--at--Excite--dot--com(at)mta5(dot)snfc21(dot)pbi(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Failed Connection (again)
Date: 2001-06-11 23:12:23
Message-ID: 3.0.5.32.20010611161223.00c4b3a0@postoffice.pacbell.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Oops, Yes, the url WAS wrong... however, correcting it has not made a difference... still getting the errors as described way below.

The first error text is recognizable from the source code....
catch (ClassNotFoundException cnfex)

The second... not so sure Where that comes from

At 10:51 AM 6/11/01 -0400, Dave Cramer wrote:
>It would look like the url is wrong
>
>it should look something like
>
>"jdbc:postgresql://ebox2.sentricity.com/tickets"
>
>note the "jdbc:postgresql" part
>the "ebox2.sentricity.com" is the machine
>the "tickets" is the db
>
>my icq # is 14675561 if this doesn't work
>
>Cheers,
>
>Dave
>----- Original Message -----
>From: "Gonzo Programming"
><GonzoRock--at--Excite--dot--com(at)mta6(dot)snfc21(dot)pbi(dot)net>
>To: <pgsql-jdbc(at)postgresql(dot)org>
>Sent: Friday, June 08, 2001 1:03 PM
>Subject: [JDBC] Failed Connection (again)
>
>
>> 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 );
>> }
>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 5: Have you checked our extensive FAQ?
>>
>> http://www.postgresql.org/users-lounge/docs/faq.html
>>
>>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>message can get through to the mailing list cleanly
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Philip Crotwell 2001-06-12 02:24:17 Re: Re: [JDBC] unlink large objects
Previous Message Bruce Momjian 2001-06-11 22:11:10 Re: Couple of patches for jdbc driver