php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25958 odbc_connect fails to login to remote Dbase 5
Submitted: 2003-10-22 18:19 UTC Modified: 2003-11-02 11:18 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: brian dot garvis at mascommsys dot com Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.3.2 OS: Windows 2003 Server
Private report: No CVE-ID: None
 [2003-10-22 18:19 UTC] brian dot garvis at mascommsys dot com
Description:
------------
odbc_connect fails to connect to a Dbase 5 database which resides on a separate Windows 2000 machine using Microsoft ODBC Data Source Administrator.  If move database to local machine and point ODBC to local database, then works.

PHP reports error: 
Warning: SQL error: [Microsoft][ODBC dBase Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides., SQL state S1009 in SQLConnect in C:\DEMO\wwwroot\login.php on line 16



Reproduce code:
---------------
<?php
//Connection statement
// *** Start the session
include "./WebFront/-general includes-/functions.php";
session_start();
// *** Validate request to log in to this site.
$KT_LoginAction = $HTTP_SERVER_VARS["REQUEST_URI"];
if (isset($HTTP_POST_VARS["id"])) {
  $KT_valUsername = $HTTP_POST_VARS['id'];
  $KT_fldUserAuthorization = "SecurityLevel";
  $KT_redirectLoginSuccess = "WebFront/Generated/Lobby.php";
  $KT_redirectLoginFailed = "login.php";
 $odbcSASI=odbc_connect("DEMOSASI","Administrator","z911!ABC");
 $odbcLOGIN=odbc_connect("DEMOLOGIN","","");
 $resultRS=odbc_exec($odbcSASI,"SELECT * FROM AUSR WHERE UCASE([USERID])='" . strtoupper(noquotes($_POST['id'])) . "'") or die(odbc_errormsg());
 $tempArray=odbc_fetch_array($resultRS);

Expected result:
----------------
Successful Database connection 

Actual result:
--------------
Warning: SQL error: [Microsoft][ODBC dBase Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides., SQL state S1009 in SQLConnect in C:\DEMO\wwwroot\login.php on line 13

Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\DEMO\wwwroot\login.php on line 15
[Microsoft][ODBC dBase Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-22 19:42 UTC] kalowsky@php.net
Please include your DSN entry, and a SQL Log for the connection attempt if you can.  From the sounds of it, you're not configured properly on the ODBC Administrator end, and thus not a PHP bug. 
 [2003-10-23 14:34 UTC] brian dot garvis at mascommsys dot com
Turning on Machine-Wide tracing using odbctrac.dll in ODBC Data Source Administrator and reproducing the problem does not create any entries in the SQL.LOG.  I did make the user "Administrator" invalid for the shared drive and the SQL.LOG file filled quickly with errors.  Errors stopped when I added the "Administrator" user back on the shared drive.

From my ODBC Data Source Administrator, System DSN, System Data Sources:
Name: DEMOSASI
Driver: Microsoft dBase Driver (*.dbf)

From the ODBC dBASE Setup for DSN DEMOSASI:
Data Source Name: DEMOSASI
Database VErsion: dBase 5.0
Directory: Z:\ (mapped shared folder where DB resides on another machine)
Driver:
  Collating Sequence: ASCII
  Page Timeout: 5
 [2003-10-30 18:49 UTC] brian dot garvis at mascommsys dot com
After working on this for the past week with anyone and everyone we could find to help out, we are still where we started.  

We have verified that MS ODBC works fine to database on local machine.  We have tried to connect to different databases on different remote machines using both php and MS Query.  MS Query has no problem accessing remote DBase & Access databases using the same DSN's that PHP is using.  PHP to the same remote databases always returns the same errors with a "null" "Resource ID #".
 [2003-10-31 09:38 UTC] kalowsky@php.net
If you cannot give me a trace of the SQL connection, I 
cannot help you.  
 [2003-10-31 17:40 UTC] brian dot garvis at mascommsys dot com
I can give you the trace, but it is a zero byte file.  ODBC does not see any errors.  The trace only produces a file on error.
 [2003-11-01 10:37 UTC] kalowsky@php.net
If the SQL.log is blank, it is not finding the driver 
requested.  That would indicate an ODBC configuration 
error on the local machine, not a PHP error.  That 
explination fits with your initial error.
 [2003-11-02 07:42 UTC] brian dot garvis at mascommsys dot com
I have had 5 others try and make this work now.  No one can get php to work with a DSN when the drive is mapped.  I have searched everything online that I could find and it seems that no one has been successful.  I guess that everyone out there is configuring theirs wrong as well.  Please show me one example or person that has gotten this to work?
 [2003-11-02 11:10 UTC] kalowsky@php.net
Not a PHP bug, please leave marked as bogus.  From the 
Microsoft documentation area:

"STATUS
 This behavior is by design.  "

....

" For example, if the client machine has a mapped drive 
to the database (M:\DataFolder\Database.mdb), it works 
fine at design-time.  However, when viewed in the 
browser, the Web server processes the code based on the 
information given.  The Web server checks its M: drive, 
which more than likely does not have a valid path to 
the database.  "


 [2003-11-02 11:18 UTC] kalowsky@php.net
I should add that this is provided you are using IIS, I 
am unsure if Apache would get the same results.
 [2003-12-15 07:15 UTC] boa at weboa dot org
The same error appear on:
Windows XP Professionnal v2002 SP-1
Apache 1.3.24
PHP 4.3.3
Width odbc (dbase IV, access 32bits for AS400) on remote database file.

And the sql.log stayed void.

Test with the same files under a local directory and all work perfectly.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Thu Jul 19 17:01:25 2018 UTC