views:

249

answers:

5

hi all,

In our project we are using postgresSql(8.3) as the database server, but we are rarely facing problem (once a while) . in the log file i am seeing error Like

   ****Connection attempt failed****

it means for me that , application is attempting to get connection object from the DB server but it was unsuccessfull.

Strange thing is when i restart database server or Webserver(Tomcat ) it will work normally. I will get this error rarely.

Please suggest me with the solution.

regards, Mahesh

A: 

This is common in web-apps when a user cancels the request and the server kills the connection in mid-request. It sounds like it isn't actually stopping the server right?

SpliFF
A: 

Here are a few things that could be causing this, without more details I cannot say more.

1.Network error. There is a chance that part of the Connection String is not being passed to PostgreSQL. See item 2.

2.The Connection String is corrupted. Is the connection string being created dynamically?

3.Problem in the connection pool. This should throw an error in your connection pool though. Without knowing what type of connection pool you are using, I can not rule it out.

WolfmanDragon
A: 

I have the same problems on Windows and FreeBSD installations of PostgreSQL. I don't use Tomcat and this problem often appears also with PgAdmin. I have localhost configured in DNS. This is happenning once in a while... otherwise working very smoothly...

MK
A: 

You may be exceeding the maximum number of connections. Have a look in postgresql.conf for the max_connections parameter, its default is 100 on most builds.

netstat -tn | grep -c 5432

Should give you an approximation of the number of connections currently open.

Bell
A: 

Ensure that you're closing resources (connection, statement, resultset) in the finally block after opening them. If you're using a connection pool, also ensure that its maxsize is not set too high.

BalusC