MySQL : Too many connections

Jeff Bauer jbauer at rubic.com
Thu Mar 13 10:37:30 EST 2003


Thomas,

You haven't indicated what type of application you're
running with MySQL.  For web applications, I create a
single database connection object per user session,
running as a persistent connection (a.k.a long running
process).  All database queries are passed through the
database connection object.

In other words, you should only require one database
connection per process space (or modulo # of databases,
if accessing multiple databases).

Jeff Bauer
Rubicon Research


> I get an exception using MySQL, "Too many connections". I understand
> the error and why it occurrs, but how can I avoid it?? Do I close
> after each cursor.execute-call or do I close the connection?? In
> case of closing after the execute-call, how ??
> 
> What is the proper way of inserting a lot of records and during
> this process check rows allready inserted and avoid the problem
> above?





More information about the Python-list mailing list