Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Strange Occurrence of An ODBC Related Error Message

Posted on 2008-06-20
15
Medium Priority
?
734 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 2000 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

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
 
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

963 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