Thread: Connecting postgreSQL using JDBC

Connecting postgreSQL using JDBC

From
"Howard"
Date:
I have just tried a sample Java program. It connects the PostgreSQL through
the JDBC. I ran it on the postgreSQL machine. It works fine. But, when I
tried to run it in another machine and connecting the database through the
network. The connection was refused. I have no idea what is wrong.

postgreSQL:
    startup with 'postmaster -i'
java program:
    ...DriverManager.getConnection ("jdbc:postgresql:webtest", "nobody",
"");
where webtest is my testing database name.

-- Howard



RE: Connecting postgreSQL using JDBC

From
Matthew
Date:
What access does your pg_hba.conf provide for?  I think it defaults to
only allowing local access.  In order to connect to it from remote
machines the -I option needs to be given to postmaster and the
pga_hba.conf needs to allow connection from that IP to that data base
for that user.

Matt

> -----Original Message-----
> From:    Howard [SMTP:kstse@netvigator.com]
> Sent:    Tuesday, June 27, 2000 10:29 PM
> To:    pgsql-general@postgresql.org.pgsql-questions@postgresql.org
> Subject:    [GENERAL] Connecting postgreSQL using JDBC
>
> I have just tried a sample Java program. It connects the PostgreSQL
> through
> the JDBC. I ran it on the postgreSQL machine. It works fine. But, when
> I
> tried to run it in another machine and connecting the database through
> the
> network. The connection was refused. I have no idea what is wrong.
>
> postgreSQL:
>     startup with 'postmaster -i'
> java program:
>     ...DriverManager.getConnection ("jdbc:postgresql:webtest",
> "nobody",
> "");
> where webtest is my testing database name.
>
> -- Howard
>

Re: Connecting postgreSQL using JDBC

From
Travis Bauer
Date:
As was mentioned, check you pg_hba.conf.  Also, you need to specify where
in the network the server is located by further qualifying the url name:

jdbc:postgresql://host_name_here/database_name

----------------------------------------------------------------
Travis Bauer | CS Grad Student | IU |www.cs.indiana.edu/~trbauer
----------------------------------------------------------------

On Wed, 28 Jun 2000, Howard wrote:

> java program:
>     ...DriverManager.getConnection ("jdbc:postgresql:webtest", "nobody",
> "");
> where webtest is my testing database name.