PHP provides mysql_connect() and mysql_pconnect() which allow creating both temporary and persistent database connections.
Is there a similar functionality in Python? The environment on which this will be used is lighttpd server with FastCGI.
Thank you!
If you’re using FastCGI, there’s no need for “persistent connections”, because if you create a connection it is by default persistent, since FastCGI python isn’t request based, but constantly running.
This is how FastCGI works in python, to put it short:
In PHP/FastCGI this is different, because only the PHP engine is loaded all the time, while the PHP script itself is executed for each request.
So the difference is that in Python you can define your own initialization. And that’s where you put your MySQL connection. 🙂