Solved

Strange Occurrence of An ODBC Related Error Message

Posted on 2008-06-20
15
720 Views
Last Modified: 2013-12-13
Hello, everyone.  I have set up an ODBC connection to an access database located on a network.  I have written the attached php code just to test the connection and make sure that everything is in working order.  My server is Apache, and I have it running on my local machine.  If I restart my computer/web server and run my php script, everything works as it should.  However, if I save changes to my php code after I have already ran the script, I get this error when I refresh my page in the browser:
"Warning: SQL error: [Microsoft][ODBC Microsoft Access 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:\phpdev\www\permit\permit.php on line 2
Connection Failed: "

I don't actually have to make a change to my php code in order to get this message.  If I were to just open it up and click save, I would receive the same error.  I cannot get my results to display again until I restart.  I am attaching a picture of my odbc setup.  Thanks for any help.

<?php

$conn=odbc_connect('Permits','','');

if (!$conn)

  {exit("Connection Failed: " . $conn);}

$sql="SELECT *,[Customer Name],[Customer Address]  FROM Permits where [Customer Name] = 'Ole South Properties'";

$rs=odbc_exec($conn,$sql); 

while (odbc_fetch_row($rs)) {
 
 

echo odbc_result($rs,"Customer Name"); echo "----";

echo odbc_result($rs,"Customer Address"); echo "<br>";

} 
 

?>

Open in new window

ODBC.JPG
0
Comment
Question by:thedeal56
  • 8
  • 4
  • 2
  • +1
15 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 21832886
This happens if the apache user does not have the correct rights to access/write the file.

I only found a german article which describe which settings you have to to to give the apache service the correct rights.

So rightclick on service apache -> Properties -> login and Browse User -> Advanced -> Search and select user.
You need a user which has a password and is also available with the name and password on the remote server

German article:
http://www.php-resource.de/forum/showthread.php?s=&threadid=47118#post356326
0
 

Author Comment

by:thedeal56
ID: 21834568
If it were rights issue, wouldn't it be strange that I could run my php script before I saved changes? I have changed my service properties to an account that should work, but I still get the same error.
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 21834600
Have you also restarted the services after making the changes?

Yes it is very strange if it works the first time, but upon save not. Way to tack that down is to use fielmon
http://www.microsoft.com/technet/sysinternals/processesandthreads/filemon.mspx

prepare everything to be saved, statr filemon, submit when you get that error and then check the output of filemon what is accessed and where you get violations.
0
 

Author Comment

by:thedeal56
ID: 21834673
Yes, I have restarted the services but with not luck.  The error shows up when  I refresh the browser after I save the file.  Will filemon still be useful for that error?
0
 
LVL 48

Expert Comment

by:hernst42
ID: 21834684
filemon should tell you why the file on the remote server can't be opened and which files are getting accessed. Else there is nothing I know how to chase that problem.
0
 

Author Comment

by:thedeal56
ID: 21834706
That's cool.  I'm checking out filemon now.  I should know something shortly.  Thanks for your help.
0
 

Author Comment

by:thedeal56
ID: 21835093
Here's my error logs.  The working one isn't cleaned up so well, so let me know if you need a retake on that one.  On the error, I noticed that it's not even trying to read the H drive, which is the mapped letter of the drive that contains the .mdb file.  
odbc.zip
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 48

Expert Comment

by:hernst42
ID: 21835154
Yes thats very strange that in case of an error apache/odbc does not try to open any file on H. Currently I have no idea why the error occurs and now I'm out ideas :-( Sorry
0
 
LVL 7

Expert Comment

by:Dauhee
ID: 21837503
could try copy a local version of the access file and link another dsn to verify security issues
0
 

Author Comment

by:thedeal56
ID: 21846340
I think I've got it figured out, but the steps that I'm taking for it work make no sense to me.  I'm going to attach a video in my next post, and maybe you guys and figure it out.  
0
 

Author Comment

by:thedeal56
ID: 21846557
Well, I've decided that doing a small video on it may be a little too much work haha.  Basically, the problem ended up being with my apache server.  I'm using phpdev to run my apache/mysql/php, when I really should have been using wamp.  I didn't actually switch to wamp to solve the problem, I'm just guessing that anyone who uses wamp would have never experienced this problem in the first place.  If anyone needs the actual step by step info on the solution, just ask and I'll post it.  I'm not sure how to give out the points, though.  The post about filemon really pointed me in the right direction.  Should I award the points on that post?  Thanks again for all your help.  
0
 
LVL 7

Expert Comment

by:Dauhee
ID: 21847921
Its just my opinion but if ya learned a bit from the help then points would be nice fo hernst42 's :)
0
 

Author Closing Comment

by:thedeal56
ID: 31469231
Thanks for everything!
0
 

Expert Comment

by:jesap
ID: 22125462
Thedeal56, please post your steps.. I am seeing the same thing.

Thanks
0
 

Author Comment

by:thedeal56
ID: 22129160
Do you use phpdev? If so, do you recognize the attached picture?
Apache.JPG
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now