The CI framework solves the problem that mysql database connection resources cannot be released.

Source: Internet
Author: User
Tags pconnect
This article describes how to release mysql database connection resources in the CI framework. it analyzes the causes of connection exceeding the maximum value in the CI framework and the corresponding solutions, this article describes how to configure the CI framework. if you need it, you can refer to the examples in this article to analyze the solutions that the mysql database connection resources cannot be released. We will share this with you for your reference. The details are as follows:

Use the class provided by the ci framework to query data:

$ This-> load-> database (); $ query = $ this-> db-> query ($ SQL );

After running the program for a period of time, an error is reported to inform the database of too connector connections.

Obviously, the connection resource of the MySQL database exceeds the value set by max_connections. Immediately after each query, add the resource release script:

$ This-> db-> close ();

Resources cannot be released. what should I do? Check the manual,Set pconnect to false., The settings are roughly as follows:

$ Db ['default'] ['pconnect '] = FALSE;

You do not need to call

$ This-> db-> close ();

You can automatically close the connection.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.