Solved

php connection string for OLE-DB and remote data server

Posted on 2009-04-02
5
1,511 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
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…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

734 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