Solved

Strange Occurrence of An ODBC Related Error Message

Posted on 2008-06-20
15
728 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
[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
  • 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
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…

710 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