php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26116 Unable to connect to ODBC database
Submitted: 2003-11-04 10:39 UTC Modified: 2003-11-05 08:08 UTC
From: andrew at howells-solicitors dot com Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.3.4 OS: Windows NT 4 sp6a
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: andrew at howells-solicitors dot com
New email:
PHP Version: OS:

 

 [2003-11-04 10:39 UTC] andrew at howells-solicitors dot com
Description:
------------
I am using PHP 4.3.4 & Apache 1.3.28 all on Windows NTT 4. I have a remote Progress database server that serves as backednd to a practice management and accounts suite we use in-house. I want to use PHP to provide a web based interface to this database but am having some entertaining problems.

I've tried the progress supplied Merant ODBC drivers as well as the OpenLink ODBC drivers. Both connect fine, however, if I try connecting using PHP loaded as a module ito apache I cannot connect to the DB, the ODBC driver refuses to load.

However, If I execute the script from the comand line

"php E:\webpages\intranet\sostest2.php" 

The connection is established ok.

Reproduce code:
---------------
<?php
$connection = odbc_connect("system_dsn","user_name","password", SQL_CUR_USE_ODBC);

odbc_prepare($connection, "select * from pub.users");

odbc_execute($result);


Expected result:
----------------
No errors !

Actual result:
--------------
== Using Openlink ==

Warning: odbc_connect(): SQL error: [OpenLink][ODBC][Driver]Connection rejected by data source, SQL state 08004 in SQLConnect in e:\webpages\intranet\sostest2.php on line 8

Warning: odbc_prepare(): supplied argument is not a valid ODBC-Link resource in e:\webpages\intranet\sostest2.php on line 10

Warning: odbc_execute(): supplied argument is not a valid ODBC result resource in e:\webpages\intranet\sostest2.php on line 12

== Using Merant ==

Warning: odbc_connect(): SQL error: Specified driver could not be loaded due to system error 5 (MERANT 3.60 32-BIT Progress SQL92 v9.1B)., SQL state IM003 in SQLConnect in e:\webpages\intranet\sostest2.php on line 8

Warning: odbc_prepare(): supplied argument is not a valid ODBC-Link resource in e:\webpages\intranet\sostest2.php on line 10

Warning: odbc_execute(): supplied argument is not a valid ODBC result resource in e:\webpages\intranet\sostest2.php on line 12


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-05 00:41 UTC] sniper@php.net
My uneducated guess would be that the permissions for the apache user differ to the permission for the user as which you run the script on command line. Check those.

 [2003-11-05 04:07 UTC] andrew at howells-solicitors dot com
I thought about this but made the assumption that since the Apache installer had installed the service to run as system that it *should* work. Moreover, when I found this didn't work I allowed the account to interact with the desktop - theoretically allowing it to do everythign a normal domain account would.

How wrong was I?!

Following this response I altered the startup parameters for the apache service so the service used the Domain Admin account to start itself up. This appears to have resolved the issue - it loads the ODBC driver fine.

Perhaps a footnote in the Apache / PHP installation guide would be in order for those who have Windows inflicted upon them ?
 [2003-11-05 08:08 UTC] kalowsky@php.net
Marking as bogus.

Feel free to add a comment on the user contributed notes 
about this :)  Hopefully it will make it into the full 
version.  Thanks for your time.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 11:01:27 2024 UTC