I am using PHP with Oracle Database 12c and i want to implement connection pooling for improve my application performance Can you help me please?
Check the Database Resident Connection Pooling (DRCP) chapter of Oracle's free The Underground PHP and Oracle Manual .
First determine if you need DRCP. I assume you are already using persistent oci_pconnect()
calls, which is the first thing to do to improve connection performance.
Like any pool, DRCP is a shared resource so there is some overhead and you need to make sure that connections are not held open which would block other users. If you're not running out of memory on the DB server host, I would suggest not using it.
If you decide to try it, the basic steps are:
SQL> execute dbms_connection_pool.start_pool()
oci8.connection_class = MYPHPAPP
$c = oci_pconnect('myuser', 'mypassword', 'myhost/sales:POOLED');
or$c = oci_pconnect('myuser', 'mypassword', 'salespool');
where the connect alias is in a tnsnames.ora file: salespool=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=myhost.dom.com) (PORT=1521))(CONNECT_DATA=(SERVICE_NAME=sales) (SERVER=POOLED)))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.