Re: Using the JDBC Driver in version 7.02 - Mailing list pgsql-general

From Peter Mount
Subject Re: Using the JDBC Driver in version 7.02
Date
Msg-id 03f601bfeac3$59762320$152329d4@retep.org.uk
Whole thread Raw
In response to Using the JDBC Driver in version 7.02  ("Justin Jaynes" <justinjaynes@hotmail.com>)
Responses Re: Using the JDBC Driver in version 7.02
List pgsql-general
----- Original Message -----
From: Joseph Shraibman <jks@selectacast.net>
To: Justin Jaynes <justinjaynes@hotmail.com>
Cc: <pgsql-general@postgresql.org>
Sent: Monday, July 10, 2000 9:57 PM
Subject: Re: [GENERAL] Using the JDBC Driver in version 7.02


> You have to format your url properly so the java runtime can figure out
> what driver to use for the connection.
>
> Justin Jaynes wrote:
> >
> > Hello.  I am using Postgres 7.02 on my redhat linux box.  I have
installed
> > the JDK and a JSP engine.
> >
> > I have also copied the JDBC level 4 Drivers that came with postgresql
7.02
> > onto my hard drive.
> >
> > When I try to interface with it in java, even after loading the driver
with
> > the line:
> >
> > Class.forName("org.postgresql.Driver");
> >
> > I get an error that the DriverManager cannot find a suitable driver.
> >
> > The code I use to connect goes as follows:
> >
> > Connection chamber = DriverManager.getConnection("localhost:5432");

This isn't a valid JDBC URL. You'll need something like:

    jdbc:postgresql:database            <= Use when on local host
    jdbc:postgresql://server/database    <= Use when on remote host

> >
> > I also tried it as:
> >
> > Connection chamber =
> > DriverManager.getConnection("localhost:5432","username","password");
> >
> > and still no luck.
> >
> > Can anyone help with this problem?
> >
> > I have two suspicions:  First, that I am not pointing to the right class
in
> > the jar file.  Driver.class might be the wrong file to start with.
Second,

That is the correct one (other than when using data sources)

> > maybe my server is not taking requests properly, so Java says "hey, this
> > driver is not working." when it's not the drivers fault, but the servers
> > fault.
> >
> > Just so you know, I set up my server to trust all localhost connections.
> > ________________________________________________________________________
> > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


pgsql-general by date:

Previous
From: "Randall Parker"
Date:
Subject: Auto-increment and data importing: problem pointed out in PHP builder review?
Next
From: Philip Warner
Date:
Subject: pg_dump with BLOBS & V7.0.2 fix