php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25285 Unable to get IDispatch interface to ado but ACL's all correct and it's random
Submitted: 2003-08-28 03:01 UTC Modified: 2003-08-28 03:26 UTC
From: bodgadle at yahoo dot co dot uk Assigned:
Status: Wont fix Package: COM related
PHP Version: 4.3.3 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bodgadle at yahoo dot co dot uk
New email:
PHP Version: OS:

 

 [2003-08-28 03:01 UTC] bodgadle at yahoo dot co dot uk
Description:
------------
Just upgraded to 4.3.3 last night and noticing some errors in my php log file. Now this is not related to ACL's on the machine as that has been setup correctly, there are no errors in the windows event viewer either. And even weirder is that the code works fine for a few hours and then just suddenly i get the above errors everytime i try to access our database using ADO. A full restart of apache fixes it but until that's done our site doesnt show any data.

The exact error is

[28-Aug-2003 02:51:00] PHP Warning:  (null)(): Unable to obtain IDispatch interface for CLSID {00000514-0000-0010-8000-00AA006D2EA4}: CoInitialize has not been called.  in E:\www\reports\monitoring.php on line 4


Here's 2 examples of code it happens a lot in

$query = "SET NOCOUNT ON;DELETE T_ARTICLE_LINKS WHERE AL_ID=".$linkID.";SELECT @@ROWCOUNT AS ROWS";
		$result = 0;
		$conn = new COM("ADODB.Connection");$conn->CommandTimeout=0;$conn->ConnectionTimeout=0;
		@$conn->Open($_ENV["OUR_CONN"]);
		if ($conn->state == 1) {
			$rs = $conn->Execute($query);
			$rows=$rs->Fields[0]->Value;$rs->Close();$rs->Release();$rs=null;unset($rs);
			$conn->Close();
			$conn->Release();$conn=null;unset($conn);
		}
		return $rows;



and here's an example using a stored procedure

$conn = new COM("ADODB.Connection");$conn->CommandTimeout=0;$conn->ConnectionTimeout=0;
		@$conn->Open($_ENV["NUSONLINE_CONN"]);
		if ($type != '') {
			$t_id = ($typeID != '') ? $typeID : 0;

			$cmd = new COM("ADODB.Command");
			$cmd->ActiveConnection = $conn;
			$cmd->CommandType = 4;
			$cmd->CommandText = "proc_POSTER_TYPES";

			$cmd->Parameters->Append($cmd->CreateParameter("@RETURN_VALUE", 3, 4, 0, ($RETURN_VALUE=0)));
			$cmd->Parameters->Append($cmd->CreateParameter("@typeid", 131, 3, 0, $t_id));
			$cmd->Parameters->Append($cmd->CreateParameter("@name", 200, 1, 1, stripslashes($typeName)));
			$cmd->Parameters->Append($cmd->CreateParameter("@successflag", 131, 3, 0, $successflag));

			$cmd->Parameters["@typeid"]->Precision = 18;
			$cmd->Parameters["@successflag"]->Precision = 18;

			$cmd->Execute();

			$typeid = $cmd->Parameters["@typeid"]->Value;
			$successflag = $cmd->Parameters["@successflag"]->Value;
			$conn->Close();
			$cmd->Release();$cmd=null;unset($cmd);
			$conn->Release();$conn=null;unset($conn);

		}



again the errors arent to do with the SQL/SP's used as they happen on the creation of the COM object.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-28 03:26 UTC] sniper@php.net
The com extension has been completely rewritten in PHP5 and the PHP4 com extension is no longer being maintained. If you find bugs with the com extension in PHP5 please report them.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 14:01:29 2024 UTC