2

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.

3
  • Can you provide some more info on your environment, applications since the cause may be outside of postgres. Commented May 21, 2009 at 11:34
  • Is this error in the tomcat log? If so, is there an exception backtrace? Are there any errors in the postgresql log around that time? Commented May 21, 2009 at 11:51
  • Need more info for this. Commented Sep 5, 2012 at 10:00

4 Answers 4

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

0

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?

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.