Welcome Guest, Not a member yet? Register   Sign In
Database connection flood
#1

[eluser]Ku Yu Cheung[/eluser]
Hello, i'm experiencing problems with my code:

each time that the application's homepage is loaded, a new (fresh) database connection is created and it stays open.

If there are many open connections, the application can be slow in responding or can stop working. this issue happens only on the production server, and i think that is a mysql issue. I see that the db assigns a new port for each new connection created. Can CI be forced to use always the same connection?
#2

[eluser]Bhashkar Yadav[/eluser]
can you please check by updating as FALSE to $db['default']['autoinit'] into application/config/database.php.
#3

[eluser]Ku Yu Cheung[/eluser]
just updated the configuration, nothing has changed Sad
#4

[eluser]Ku Yu Cheung[/eluser]
Perhaps CI leaves some db connection open after the scripts are finished?
#5

[eluser]CroNiX[/eluser]
No, CI terminates the connection at the very end of /system/core/CodeIgniter.php.

Try disabling the Persistent Connections: $db['default']['pconnect'] = FALSE;
#6

[eluser]Ku Yu Cheung[/eluser]
thank you, this solved my issue Smile Smile
#7

[eluser]InsiteFX[/eluser]
Things to try!
Code:
// port - The database port number. To use this value you have to add a line to the database config array.
$db['default']['port'] = 5432;

// also try this
$this->db->close();

pconnect causes problems do not use it!
#8

[eluser]Bhashkar Yadav[/eluser]
@InsiteFX : Thanks a lot, i was also digging into it but couldn't notice persistence database connection setting ...




Theme © iAndrew 2016 - Forum software by © MyBB