Welcome Guest, Not a member yet? Register   Sign In
How CodeIgniter close db connections?
#5

Thank you dave friend for the reply. I'll look at your proposed solution (since it's a large application and I'll have to really dig deep to implement this correctly). Meanwhile, can you please give some feedback on the following.
  • There are three database groups.
  • Database library is not autoloaded. (Although either case is resulting in same problem).
  • Only one DB object created through load->database('group', TRUE) call per model.
  • $DB1, $DB2 structure not implemented.
  • Cross-database joins are made through this example code
PHP Code:
$this->db->select()
         ->from()
         ->join(db2Name.tblName
  • Multiple models are loaded for loading the page in question.
  • Each model is, thus, making a load->database('group') call, in some cases with the same parameters as other model(s).
Based on this structure, and your suggestion,
Quote:Your 'max_user_connections' troubles might be related to making calls to load->database() with the same parameters.
do you think, 
(a) the multiple load->database() calls with same parameters even for single $DB (group) object can cause the 'max_user_connections' problem?
(b) the method used for cross-database joins can cause the 'max_user_connections' problem? (CI's handling of connections made through this method, in presence of groups, is also unclear).

Logically, I'd think that since multiple databases are supported in CI through groups, and each group can only be accessed through load->database('group'):
  • After autoloading 'database' library, load->database('group') calls should only be accessing particular database group and should not be initiating additional connections.
  • If CI believes it necessary to establish new connection at each load->database('group') call, then each connection thus established in a model should be closed automatically at the end of execution of that model. 
What do you think? Thank you for your time.
Reply


Messages In This Thread
RE: How CodeIgniter close db connections? - by xuhaib - 05-24-2017, 01:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB