views:

771

answers:

1

I am getting the error OperationalError: FATAL: sorry, too many clients already when using psycopg2. I am calling the close method on my connection instance after I am done with it. I am not sure what could be causing this, it is my first experience with python and postgresql, but I have a few years experience with php, asp.net, mysql, and sql server.

EDIT: I am running this locally, if the connections are closing like they should be then I only have 1 connection open at a time. I did have a GUI open to the database but even closed I am getting this error. It is happening very shortly after I run my program. I have a function I call that returns a connection that is opened like:

psycopg2.connect(connectionString)

Thanks

Final Edit: It was my mistake, I was recursively calling the same method on mistake that was opening the same method over and over. It has been a long day..

A: 

This error means what it says, there are too many clients connected to postgreSQL. Are you the only one connected to this database? Are you running a graphical IDE? What method are you using to connect? Are you testing queries at the same time that you running the code? any of these things could be the problem. If you are the admin, you can up the number of clients, but if a program is hanging it open, then that won't help for long.

There are too many reasons that you could be having too many clients running at the same time with the sparse info that you gave us.

WolfmanDragon