Re: [GENERAL] DriverManager.getConnection() fails sometimes but succeeds other times

Поиск
Список
Период
Сортировка
От Marin Dimitrov
Тема Re: [GENERAL] DriverManager.getConnection() fails sometimes but succeeds other times
Дата
Msg-id 000801c1d009$297dfc10$9b0e32d4@sirma.bg
обсуждение исходный текст
Список pgsql-jdbc
> Michael E Mercer <mmercer@lboard.com> wrote in message
news:<3C960A14.B45611B@lboard.com>...
> > Hello,
> >
> > I have a java program running as root and tries to connect to database
> > as user
> > 'A' with password 'A'.
> >
> > The pg_hba.conf is set to allow users to connect from any host with md5
> > authentication.
> >
> > The java program uses the same method to connect to the database,
> > however
> > sometimes authentication
> > succeeds and sometimes it fails. The user and password are hard coded,
> > so there
> > is no probable error there.
> >

I have the very same problem here - Postgres 7.2 on RH 7.2, JDBC driver is
[PostgreSQL 7.2b5 JDBC2] from the official site

getConnection seems to fail when called after some period of inactivity, but
if a subsequent attempt is made then it is successful

a sample code would look like:

    Connection conn =
DriverManager.getConnection("jdbc:postgresql://192.168.128.208:5432/gate09?u
ser=gateadmin&password=gate");


the pg_hba.conf contains:

=============
host    all    192.168.128.42    255.255.255.255    md5
host    all    212.50.14.155    255.255.255.255    md5
=============

...where the above are the two IPs of my machine (the JDBC client)


the log file contains:

==========
FATAL 1:  Password authentication failed for user "gateadmin"
DEBUG:  pq_recvbuf: recv() failed: Connection reset by peer
==========


any hints?


thanx,

    Marin

----
"...what you brought from your past, is of no use in your present. When
you must choose a new path, do not bring old experiences with you.
Those who strike out afresh, but who attempt to retain a little of the
old life, end up torn apart by their own memories. "





В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Dave Cramer"
Дата:
Сообщение: Re: "No results were returned by the query" exceptions
Следующее
От: Doug McNaught
Дата:
Сообщение: Re: [HACKERS] problems with Tomcat and postgres