Re: Help with JDBC connection...

Lists: pgsql-jdbcpgsql-novice
From: Lachlan Deck <ldeck(at)tpg(dot)com(dot)au>
To: pgsql-novice(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org
Subject: Help with JDBC connection...
Date: 2002-11-13 17:29:15
Message-ID: 6ED45F02-F72D-11D6-B553-0005025E2371@tpg.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc pgsql-novice

Hi there,

I'm running Postgresql 7.2.1 on Mac OS X 10.1.5 and can't connect via
jdbc. Any help would be great. Thanks....

I can connect without problems to the database via psql as in
>psql dbname

I have the following in pg_hpa.conf
local
all trust
host all 192.168.1.0 255.255.255.0 trust

Postgres postmaster is started up at system boot by calling the
following function:

startPostgres()
{
if [ "${POSTGRES:=-YES-}" = "-YES-" ]; then
ConsoleMessage "Starting PostgreSQL database server"
# Some trickery to get around tcsh's inability to
# handle this redirect
#
su - postgres -c 'sh -c "/usr/local/bin/postmaster -i -D
/usr/local/pgsql/data >> /usr/local/pgsql/logfile 2>&1 &"'
fi

I'm using the TestPostgreSQL.java file from
http://www.entropy.ch/software/macosx/postgresql/
Compiles fine.
then doing the following I get

[localhost:/Users/Shared] postgres% java -classpath
/usr/local/pgsql/share/java/postgresql.jar:. TestPostgreSQL
Exception in thread "main" Something unusual has occured to cause the
driver to fail. Please report this exception: Exception:
java.sql.SQLException: FATAL 1: No pg_hba.conf entry for host
192.168.1.2, user postgres, database template1

Stack Trace:

java.sql.SQLException: FATAL 1: No pg_hba.conf entry for host
192.168.1.2, user postgres, database template1

at org.postgresql.Connection.openConnection(Connection.java:178)
at org.postgresql.Driver.connect(Driver.java:149)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at TestPostgreSQL.main(TestPostgreSQL.java:75)
End of Stack Trace

at org.postgresql.Driver.connect(Driver.java:166)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at TestPostgreSQL.main(TestPostgreSQL.java:75)
[localhost:/Users/Shared] postgres%

What would be going wrong?

with regards,

--
Lachlan Deck
ldeck(at)tpg(dot)com(dot)au


From: Varun Kacholia <varunk(at)cse(dot)iitb(dot)ac(dot)in>
To: Lachlan Deck <ldeck(at)tpg(dot)com(dot)au>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Help with JDBC connection...
Date: 2002-11-13 17:54:17
Message-ID: 20021113232728.B24443@cse.iitb.ac.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc pgsql-novice

> Hi there,
>
> I'm running Postgresql 7.2.1 on Mac OS X 10.1.5 and can't connect via
> jdbc. Any help would be great. Thanks....
>
> I can connect without problems to the database via psql as in
> >psql dbname
>
> I have the following in pg_hpa.conf
> local
> all trust
> host all 192.168.1.0 255.255.255.0 trust

Did you try:

> host all 192.168.1.2 255.255.255.255 trust
(provided you are connecting from 192.168.1.2)
though a temporary work-around, but it could give some more info
where exactly the problem could be.
----
Varun