MySQL : Too many connections
2002 at weholt.org
Thu Mar 13 19:33:04 CET 2003
It's a application that scans a cdrom/dvd-rom and inserts records describing
each file found. Then I create an index of words used in filename and paths
on the media that was scanned. This process contains both inserts and
selects on allready inserted records. It's a script run once a while, not a
It seems as if the opened connections are not closed after the script has
finished. Why? Do I have to call close on the connections manually? This is
not done in any of the examples I've seen. In "MySQL Control Center" I see
more and more open connections listed as I run my code.
"Jeff Bauer" <jbauer at rubic.com> wrote in message
news:mailman.1047569967.24366.python-list at python.org...
> 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