Skip site navigation (1) Skip section navigation (2)

Help with JDBC connection...

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 (view raw or flat)
Thread:
Lists: pgsql-jdbcpgsql-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


Responses

pgsql-novice by date

Next:From: Varun KacholiaDate: 2002-11-13 17:54:17
Subject: Re: Help with JDBC connection...
Previous:From: Tuna ChatterjeeDate: 2002-11-13 16:59:22
Subject: Re: Describe a table

pgsql-jdbc by date

Next:From: Varun KacholiaDate: 2002-11-13 17:54:17
Subject: Re: Help with JDBC connection...
Previous:From: Barry LindDate: 2002-11-13 17:23:40
Subject: Re: setUseServerPrepare & typecasts

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group