CodeIgniter Forums
No of open connections - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: No of open connections (/showthread.php?tid=35994)



No of open connections - El Forum - 11-17-2010

[eluser]kakawett[/eluser]
I was just wondering about the next syntax :

$this->load->database();

Does it create a connection or check that there's an open connection before creating a new one ?

If I simply past $this->load->database() at the begining of all of my functions, I won't get 2100 simultaneously open connections right ?
I'm pretty sure it's the case, I just wanna be sure.


No of open connections - El Forum - 11-17-2010

[eluser]smilie[/eluser]
As users manual says:

"Reconnecting / Keeping the Connection Alive

If the database server's idle timeout is exceeded while you're doing some heavy PHP lifting (processing an image, for instance), you should consider pinging the server by using the reconnect() method before sending further queries, which can gracefully keep the connection alive or re-establish it.

$this->db->reconnect();"

I would guess that it closes the connection once PHP is done...
Also in core folder, there is _close() function which closes MySQL connection.

And at the end, most MySQL servers (at least, by default) close connection after some idle time...

Cheers,
Smilie


No of open connections - El Forum - 11-17-2010

[eluser]kakawett[/eluser]
ow thanks, missed that part