RE: JDBC prob. Continued

From: Peter Mount <petermount(at)maidstone(dot)gov(dot)uk>
To: "'tony'" <tony(at)uickarate(dot)com>, Michael Stephenson <mstephenson(at)tirin(dot)openworld(dot)co(dot)uk>
Cc: pgsql-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: RE: JDBC prob. Continued
Date: 2000-11-17 07:27:12
Message-ID: 1B3D5E532D18D311861A00600865478CF1B560@exchange1.nt.maidstone.gov.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

If the host is localhost, then you don't need to supply the hostname in the
url.
Same goes for the port, if missing it defaults to 5432.

As for hostname/ip address, you can use either - it's only when dealing with
applets when this has to be precise.

Peter

--
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount(at)maidstone(dot)gov(dot)uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council

-----Original Message-----
From: tony [mailto:tony(at)uickarate(dot)com]
Sent: Thursday, November 16, 2000 4:42 PM
To: Michael Stephenson
Cc: pgsql-interfaces
Subject: Re: [INTERFACES] JDBC prob. Continued

The host could be just localhost
if this is running only on localhost, right?
Or do I have to specify an IP?

Thanks,

Tony

----- Original Message -----
From: "Michael Stephenson" <mstephenson(at)tirin(dot)openworld(dot)co(dot)uk>
To: "tony" <tony(at)uickarate(dot)com>
Cc: "pgsql-interfaces" <pgsql-interfaces(at)postgresql(dot)org>
Sent: Thursday, November 16, 2000 12:37 PM
Subject: Re: [INTERFACES] JDBC prob. Continued

> On Thu, 16 Nov 2000, tony wrote:
>
> > I'm using 7.0.
> > Greg told me that SQLException is thrown by
> > getConnection();
> > so I've changed by getConnection to
> > DriverManager.getConnection("jdbc:postgresql:database_name", "postgres",
> > "password");
> > and the error changed to something like this:
> > SQLException: Connection refused. Check that th ehostname and port is
> > correct, and
> > tha thte postmaster is runing with the -i flag, which enables TCP/IP
> > networking.
> >
> > Any ideas??
>
> >From reading the error message I'd suggest, either you have the hostname
> and port incorrect, correct use is:
>
> DriverManager.getConnection(
> "jdbc:postgresql://[host]:[port]/[db_name]",
> "[username]", "[password]");
>
> Or you're not running postmaster with the -i flag, I use:
>
> postmaster -i -p [port] -D [data directory]
>
> If it's neither of those, then I'm sorry for being patronising.
>
> Hope this helps,
>
> Michael Stephenson
>
>

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter Mount 2000-11-17 07:28:54 RE: JDBC prob. Continued
Previous Message Peter Mount 2000-11-17 07:23:20 RE: JDBC prob. Continued