Help with JDBC connection... - Mailing list pgsql-novice

From Lachlan Deck
Subject Help with JDBC connection...
Date
Msg-id 6ED45F02-F72D-11D6-B553-0005025E2371@tpg.com.au
Whole thread Raw
List 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@tpg.com.au


pgsql-novice by date:

Previous
From: Tuna Chatterjee
Date:
Subject: Re: Describe a table
Next
From: Setyo Nugroho
Date:
Subject: Can't add records