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: 499c4b1b0708271342r1ab7bf86gef85be56fb015580@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
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
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

Responses

Browse pgsql-admin by date

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