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

Problems connecting to postgres using JDBC Driver.

From: Daniel Muñoz <daniel(dot)munoz(at)karinasoft(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Problems connecting to postgres using JDBC Driver.
Date: 2007-08-27 20:42:05
Message-ID: (view raw or whole thread)
Lists: pgsql-admin
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
        at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(
        at org.postgresql.core.ConnectionFactory.openConnection(
        at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(
        at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(
        at org.postgresql.jdbc3.Jdbc3Connection.<init>(
        at org.postgresql.Driver.makeConnection(
        at org.postgresql.Driver.connect(
        at java.sql.DriverManager.getConnection(
        at java.sql.DriverManager.getConnection(
        at Connect.main(

the pg_hba.conf file is located in:  /var/lib/pgsql/data    and it looks
like this:


# "local" is for Unix domain socket connections only
#local   all         all                               ident sameuser
local   all     all             md5
# IPv4 local connections:
#host    all         all          ident sameuser
host    all     all     ubuntu  md5
host    all     all    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 Muñoz Honiball
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
2 Crónicas 7-14


pgsql-admin by date

Next:From: Neil Peter BraggioDate: 2007-08-27 21:28:29
Subject: Re: Problems connecting to postgres using JDBC Driver.
Previous:From: Medi MontaseriDate: 2007-08-27 17:04:00
Subject: Re: PostgreSQL and virtualization

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