Re: Failed Connection (again) - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: Failed Connection (again)
Date
Msg-id 08e001c0f286$09b721b0$0302a8c0@INSPIRON
Whole thread Raw
In response to Failed Connection (again)  (Gonzo Programming <GonzoRock--at--Excite--dot--com@mta6.snfc21.pbi.net>)
Responses Re: Failed Connection (again)
List pgsql-jdbc
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@mta6.snfc21.pbi.net>
To: <pgsql-jdbc@postgresql.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
>
>


pgsql-jdbc by date:

Previous
From: "Paul Hart"
Date:
Subject: Password authentication failure
Next
From: "Jeff Waugh"
Date:
Subject: Re: Password authentication failure