Link to home
Start Free TrialLog in
Avatar of Alder
Alder

asked on

Problems with ODBC linking to data on another computer

I am using PHP and having a problem with ODBC. Not sure if the problem is with PHP or with ODBC but my feeling is ODBC. Is it possible to create an ODBC connection on one computer and point it to data on another computer and it work?

The error I recieve in PHP is: "[Microsoft][ODBC dBase Driver] '(unknown)'"

Long Summary below:


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
 
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.
 
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);
 
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.
 
 
Configuration - 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
ASKER CERTIFIED SOLUTION
Avatar of rccguy
rccguy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial