php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6033 Can't open more than one non-persistent connections to the same database
Submitted: 2000-08-08 22:37 UTC Modified: 2000-08-12 00:52 UTC
From: mlemos at acm dot org Assigned: danny (profile)
Status: Closed Package: Informix related
PHP Version: 4.0 Latest CVS (08/08/2000) OS: Linux RH 6
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mlemos at acm dot org
New email:
PHP Version: OS:

 

 [2000-08-08 22:37 UTC] mlemos at acm dot org
Since Informix PHP API do not close non-persistent connections in ifx_Close
but rather at the end of script, Informix client functions fail on a second
connection attempt when shared memory connections are used with error
-27000 Cannot support multiple connections over shared memory .

Try this script to see the problem.


<?

Function Doit($database_name,$some_table)
{
 global $informix_server,$user,$password;
 
 PutEnv("INFORMIXSERVER=$informix_server");
 if(($connection=ifx_connect($database_name."@".$informix_server,$user,$password)))
 {
  if(($result=ifx_query("SELECT * FROM $some_table",$connection)))
   ifx_free_result($result);
  else
   echo "Database: $database_name Query error: ".ifx_errormsg(),"\n";
  ifx_Close($connection);
 }
 else
  echo "Connection error: ".ifx_errormsg(),"\n";
}

 $informix_server="demo_on";
 $user="informix";
 $password="password";
 DoIt("sysmaster","informix.arc_ae_view");
 DoIt("sysutils","informix.bar_action");

?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-10 04:00 UTC] danny@php.net
One solution is not to use shared memory connections
(ipcshm) but streams pipes (ipcstr) if you have them,
or tcp/ip (tlitcp or soctcp). It is the recommended way.
Despite what the manual says, ipcshm is not always faster,
it depends on the OS.

Even if you use shared memory connections you can
access as many different databases as you like with
the database:table syntax using one single connection.
You can even have transactions involving different databases
this way. It is certainly more efficient.

Danny
---

 [2000-08-11 22:21 UTC] danny@php.net
I will try to restore the PHP3 behaviour but it will take
some thinking because Zend does not release the connection
resource until the script ends, and that is a complication.

I will possibly add a "connection closed" flag internally 
so that I can re-open it when Zend recycles the existing resource.

Thanks for the feedback.

Danny
--- 
 [2000-08-12 00:52 UTC] danny@php.net
I think I have fixed it, and PHP3 behaviour is restored : ifx_close() now 
really closes the connection. ifx_connect() still recycles the existing
Zend resource but will silently reconnect behind the scenes if needed.

Multiple calls to ifx_connect() for the same link without ifx_close()
reuse the existing connection as before.

Please test & let me know if this solves your problem.

Danny
---
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 16:01:33 2024 UTC