![]() |
Connecting to the database problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Connecting to the database problem (/showthread.php?tid=32494) |
Connecting to the database problem - El Forum - 07-25-2010 [eluser]Thomas Edwards[/eluser] Having an issue with connecting to a database, usual message: "Unable to connect to your database server using the provided settings." If I use a standard script, like so, it connects fine and gets data. Code: <?php However, pop the same working settings into CI and it always returns that error. Any ideas? Connecting to the database problem - El Forum - 07-25-2010 [eluser]mddd[/eluser] Not all web / database servers support persistent connections. Try setting the config 'pconnect' setting to false. Connecting to the database problem - El Forum - 07-25-2010 [eluser]Prophet[/eluser] Triple check the settings in config/database.php and make sure $db['default']['dbdriver'] is set to "mysql". Maybe you could post your config/database.php? Connecting to the database problem - El Forum - 07-25-2010 [eluser]Thomas Edwards[/eluser] Thanks for the advice Prophet, checked that. mddd – totally worked. Does the persistent just create a slight slowdown whenever you access the database? Connecting to the database problem - El Forum - 07-25-2010 [eluser]Prophet[/eluser] Sorry for giving the obvious advice ![]() Persistent connections are database connections that don't close once the script has finished being executed. They reduce latency by removing the need to create a new connection every time a database resources is requested but can increase load in the database server. (Was that what you were asking?) Connecting to the database problem - El Forum - 07-26-2010 [eluser]mddd[/eluser] @Thomas: Prophet's explanation is correct. However if your webserver and database server are on the same machine (as in most standard shared hosting packages) the extra time will be minimal. Connecting to the database problem - El Forum - 07-26-2010 [eluser]Thomas Edwards[/eluser] It’s on a client’s shared hosting package but should have fairly minimal traffic. Thanks for the advice guys! |