永久连接不会很消耗资源,反而还会比较节省资源(这个也无定论啦;-))
对于oracle是这个样子的,当有一个连接请求后,oracle会为其建立一个连接,当然了如果再连,还有可能创建,因为oracle实现的是一个连接池,而不是一个连接,所以可能会出现多个连接,然后php共享这些连接
对于oracle是这个样子的,当有一个连接请求后,oracle会为其建立一个连接,当然了如果再连,还有可能创建,因为oracle实现的是一个连接池,而不是一个连接,所以可能会出现多个连接,然后php共享这些连接
我每次刷新页面,都会有一个新的Oracle连接,刷新很多次以后,可能超过了oracle的最大连接数,然后只能重起服务器.有什么解决方案吗
<?
dl(sqlrelay.so) $con=sqlrcon_alloc("host",9000,"","user","password",0,1);
$cur=sqlrcur_alloc($con); sqlrcur_sendQuery($cur,"select * from my_table"); ... do some stuff that takes a short time ... sqlrcur_sendFileQuery($cur,"/usr/local/myprogram/sql","myquery.sql");
sqlrcon_endSession($con); ... do some stuff that takes a long time ... sqlrcur_sendQuery($cur,"select * from my_other_table");
sqlrcon_endSession($con); ... process the result set ... sqlrcur_free($cur);
sqlrcon_free($con);
?>