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

Re: Problems connecting to postgres using JDBC Driver.

From: Daniel Muñoz <daniel(dot)munoz(at)karinasoft(dot)com>
To: "Neil Peter Braggio" <pbraggio(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Problems connecting to postgres using JDBC Driver.
Date: 2007-08-27 21:47:09
Message-ID: 499c4b1b0708271447s270fd6c5l6774788fc488185f@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-admin
Hi Neil.

On postgresql.conf I changed the listen_address to *.
Then commented the first host entry on pg_hba.conf
then restarted the server.

I wasnt able to log to the client on the command line (psql) because or
missing or erroneos pg_hba.conf.  So I added again the first host entry and
restarted the server again.  This time I was able to log using the client.

So I tried again the java application and I have the same error message!...


BUT  I JUST RECEIVED THE ANSWERED FROM A FEDORA FORUM!!!  I wouldn't have
guessed it never!!

It turns out that the pg_hba.conf does not accept names to identify a host,
only IPs  and i have the name of one of my computers.  I removed that host
line and it works!!!

The person who posted refers to this URL:
http://www.postgresql.org/docs/8.0/interactive/client-authentication.html#AUTH-PG-HBA-CONF

Thanks alot for your help!!


daniel



On 8/27/07, Neil Peter Braggio <pbraggio(at)gmail(dot)com> wrote:
>
> Check the parameter  listen_addresses in the postgresql.conf file to set
> the correct value for you (may be '*' to test).
>
> Remove or comment the first host entry. I guess it is not a valid
> CIDR-ADDRESS value ;-)
>
> Restart your server and try again your java application.
>
> ----
> Neil Peter Braggio
> pbraggio(at)gmail(dot)com
>
>
> On 8/27/07, Daniel Muñoz <daniel(dot)munoz(at)karinasoft(dot)com> wrote:
> >
> > Hello.  I need your help.
> >
> > I have a box running Fedora Core 6. I installed the Postgres Server
> > using yum, so i have the distributing software.
> >
> > Ever since i installed it im having problems connecting my java
> > applications to the database.
> >
> > But first thing first:
> >
> > This is the error message i get when connecting to the database:
> > Checking if Driver is registered with DriverManager.
> > Registered the driver ok, so let's make a connection.
> > Couldn't connect: print out a stack trace and exit.
> > org.postgresql.util.PSQLException: FATAL: missing or erroneous
> > pg_hba.conf file
> >         at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication
> > (ConnectionFactoryImpl.java :275)
> >         at
> > org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(
> > ConnectionFactoryImpl.java:94)
> >         at org.postgresql.core.ConnectionFactory.openConnection(
> > ConnectionFactory.java:65)
> >         at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(
> > AbstractJdbc2Connection.java:116)
> >         at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(
> > AbstractJdbc3Connection.java:30)
> >         at org.postgresql.jdbc3.Jdbc3Connection .<init>(
> > Jdbc3Connection.java:24)
> >         at org.postgresql.Driver.makeConnection(Driver.java:369)
> >         at org.postgresql.Driver.connect(Driver.java:245)
> >         at java.sql.DriverManager.getConnection(DriverManager.java :525)
> >         at java.sql.DriverManager.getConnection(DriverManager.java:171)
> >         at Connect.main(Connect.java:26)
> >
> >
> > the pg_hba.conf file is located in:  /var/lib/pgsql/data    and it looks
> > like this:
> >
> > # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
> >
> > # "local" is for Unix domain socket connections only
> > #local   all         all                               ident sameuser
> > local   all     all             md5
> > # IPv4 local connections:
> > #host    all         all         127.0.0.1/32          ident sameuser
> > host    all     all     ubuntu  md5
> > host    all     all     127.0.0.1/32    md5
> > # IPv6 local connections:
> > #host    all         all         ::1/128               ident sameuser
> > host    all     all     ::1/128 md5
> >
> >
> > somewhere I read that i should live a blank line at the very bottom of
> > the file, so i have...  Also, i have checked that each value is separated by
> > a tab.  Also, i read that the PATH and the LD_LIBRARY_PATH should include
> > the path to the postgres configuration.  So on /etc/bashrc i have the
> > following:
> >
> > export
> > LD_LIBRARY_PATH=$JMFHOME/lib:/var/lib/pgsql/data/:$LD_LIBRARY_PATH
> > export PATH=/var/lib/pgsql/data/:$PATH
> >
> >
> > Now, this is the weird thing...  I can connect using the psql client.
> >
> > psql -t template1 -U damunoz
> > and then entering the password....
> >
> > So I have no idea what is going on...  I tested with different drivers
> > with the same results.  My guess is that maybe this has something to do with
> > the Fedora's distribution.  I will post this same message to them as well.
> >
> > Thanks in advance for your help!
> >
> > daniel
> >
> >
> >
> > --
> > ========================
> > Daniel Muñoz Honiball
> > daniel(dot)munoz(at)karinasoft(dot)com
> > www.karinasoft.com
> > Software para la Gloria de Dios.
> >
> > Si se humillare mi pueblo, sobre los cuales ni nombre es invocado, y
> > oraren,
> > y buscaren mi rostro, y se convirtieren de sus malos caminos;
> > entonces yo oiré desde los cielos, y perdonaré sus pecados, y sanaré su
> > tierra.
> > 2 Crónicas 7-14
>
>
>


-- 
========================
Daniel Muñoz Honiball
daniel(dot)munoz(at)karinasoft(dot)com
www.karinasoft.com
Software para la Gloria de Dios.

Si se humillare mi pueblo, sobre los cuales ni nombre es invocado, y oraren,
y buscaren mi rostro, y se convirtieren de sus malos caminos;
entonces yo oiré desde los cielos, y perdonaré sus pecados, y sanaré su
tierra.
2 Crónicas 7-14

In response to

pgsql-admin by date

Next:From: Tom LaneDate: 2007-08-27 23:17:02
Subject: Re: how is pitr replay interruption time determined?
Previous:From: Robert TreatDate: 2007-08-27 21:42:57
Subject: how is pitr replay interruption time determined?

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