Solved

php connection string for OLE-DB and remote data server

Posted on 2009-04-02
5
1,504 Views
Last Modified: 2013-12-12
Hello,

Using PHP and trying to access Visual FoxPro DBC. We can get it to work when data is local, but production data is on another server and that fails.

We built the sting that fails on the box running PHP and when we use the Test Connection button in Data Link Proprties the test passes but when we insert it into PHP script it fails with:

 Warning: (null)(): Invoke() failed: Exception occurred. Source:
Microsoft OLE DB Provider for Visual FoxPro Description: Invalid path or file name. in d:\inetpub\wwwroot\dev\your_account\pending_orders\index.php on line 3

// This is the connection string that DOES NOT works.  Here the database is located on the file server.
//$conn = new COM("ADODB.Connection");
//$conn->Open('Provider=VFPOLEDB.1;Data Source=\\servername\foldername\pro74\PRODATA.DBC;Mode=ReadWrite|Share Deny None;Password="";Collating Sequence=MACHINE');
 
// This is the connection string that DOES works.  Here the database is located on the web server itself.
$conn = new COM("ADODB.Connection");
$conn->Open('Provider=VFPOLEDB.1;Data Source=d:\pro74\PRODATA.DBC;Mode=ReadWrite|Share Deny None;Password="";Collating Sequence=MACHINE');

Open in new window

0
Comment
Question by:BobBrink
  • 3
  • 2
5 Comments
 
LVL 25

Expert Comment

by:SStory
ID: 24054231
OK. Do you have the data providers installed on the webserver?

BTW a  great place for connection strings is:
http://connectionstrings.com/

Here's one for FoxPro:
http://connectionstrings.com/visual-foxpro

Also, I imagine that the web user doesn't have permission to that directory
0
 
LVL 25

Expert Comment

by:SStory
ID: 24054240
Since MS, I assume this is IIS and not Apache. Is that true?
If so on Windows, the IUSR_<machinename> user account will need permission to the folders you are referencing, or you will need a DSN.
0
 

Author Comment

by:BobBrink
ID: 24054511
Hello,

Yes it it IIS. I'll have the tech on site check IUSR_<machinename> user account permissions.

Thanks,

Bob
0
 
LVL 25

Accepted Solution

by:
SStory earned 500 total points
ID: 24054682
You are welcome, this is most likely the problem. You run under your credentials as a dev, but on the website it runs under this accounts credentials.  It is generally a security issue to allow that account outside of the c:\inetpub\wwwroot folder so by default it doesn't. Then one must use care when going outside of the defaults i.e. don't put anything in that other folder that you don't want them to get to.  Really they should only access the database itself, not the drivers...the system will do that.
0
 

Author Closing Comment

by:BobBrink
ID: 31565954
Thanks for the help!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question