Using MySQL with PHP MySQLi: Connections, Options, Pooling
Join the DZone community and get the full member experience.
Join For FreeThe next post in Ulf Wendel's tutorial series on MySQLi recently surfaced. This post deals with parameter defauls in MySQLi database connections, built-in connection library defaults, and connection pooling. There's also a sizable section devoted to persistent connection and the issues they can cause:
Check out the full post for all the MySQLi goodness. If you want to catch up, make sure you check out part 1 on stored procedures, part 2 on prepared statements and part 3 on multiple statements in one statement string.
A common complain about persistent connections is that their state is not reset before reuse. For example, open, unfinished transactions are not automatically rolled back. But also, authorization changes which happened in the time between putting the connection into the pool and reusing it are not reflected. This may be seen as an unwanted side-effect. On the contrary, the name persistent may be understood as a promise that the state is persisted.
Check out the full post for all the MySQLi goodness. If you want to catch up, make sure you check out part 1 on stored procedures, part 2 on prepared statements and part 3 on multiple statements in one statement string.
Topics:
Opinions expressed by DZone contributors are their own.
Comments