I am using a database in PostgreSQL 9.1,in which entry are coming continuously from another program . I am sending request from Ajax after 6 sec to fetch the latest entry.to
You can increase the max_connections in postgres, that is not the solution though. You have resource leaks. It could be any - connection not closed, result set not closed. Please go back and check the code.
Consider using a connection pooling library like c3p0/BoneCp
A general discussion on connection pooling is here (Thanks to @sinisa229 mihajlovski)