CodeIgniter Forums
Lazy database initialization - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Lazy database initialization (/thread-9434.html)



Lazy database initialization - El Forum - 06-25-2008

[eluser]Sam Dark[/eluser]
If you want to connect to the DB only when needed — add following to your database.php:
Code:
$db['default']['autoinit'] = FALSE;



Lazy database initialization - El Forum - 06-25-2008

[eluser]Yash[/eluser]
nice share Smile


Lazy database initialization - El Forum - 06-25-2008

[eluser]Scriptor[/eluser]
Wait, I thought you had to explicity tell CI to automatically connect to the DB in the first place, otherwise you could tell it to connect when you load a model.


Lazy database initialization - El Forum - 06-25-2008

[eluser]Sam Dark[/eluser]
Scriptor
Try it…