laravel-oci8 icon indicating copy to clipboard operation
laravel-oci8 copied to clipboard

How to close connection using oci_close() ?

Open afifnandya opened this issue 7 years ago • 6 comments

Anyone know to manually close the connection using oci_close() function ? becase it seems like my production server oracle connection pool is full with the idle connection

Thanks !

afifnandya avatar Apr 12 '18 11:04 afifnandya

normally everything is closed automatically by __destruct must be some issues with your shutdown process in your app...

mstaack avatar Jun 07 '18 08:06 mstaack

When using connection in laravel jobs, connection not close after to end execute, need add method close() or disconnect().

/vendor/yajra/laravel-pdo-via-oci8/src/Pdo/Oci8.php

  public function disconnect(){
    	oci_close($this->dbh);
  }

seminsergey avatar Jul 10 '18 14:07 seminsergey

okay yeah this could be added of course, but did you try to enable persistent connection? internally it uses pconnect

see: https://github.com/yajra/pdo-via-oci8/blob/c85f61cf38f7251d1091cddb9e62f261c421075a/src/Pdo/Oci8.php#L454

mstaack avatar Jul 10 '18 16:07 mstaack

I dont use PDO::ATTR_PERSISTENT in $options.

seminsergey avatar Jul 10 '18 16:07 seminsergey

@seminsergey than please try it out, usually its a really good idea to use persistent connections to dbs etc..... helps you to reduce connection overhead...

mstaack avatar Jul 10 '18 16:07 mstaack

@mstaack limit max_connection does not allow me to use a persistent connection.

seminsergey avatar Jul 10 '18 16:07 seminsergey

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Nov 17 '22 03:11 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Nov 25 '22 02:11 github-actions[bot]