Link to home
Start Free TrialLog in
Avatar of bgraves
bgravesFlag for United States of America

asked on

New IIS, Win Server 2019 install. ODBC via php driver not see network files

I have a small PHP 7.4 program running off IIS 10 on Win Server 2019. Fresh Server 2019 install.

The program makes an odbc connect to a local .accdb file no problem.
It fails to connect to any network copy of that file:
   Mapped a drive letter -or-
   unc \\192.168....\folder\file.accdb   -or-
   \\Server_name\folder\file.accdb

Running the same code from VS 2019 on a non-server PC (uses IIS Express) works fine to all of the above test files. The reported error is:

SQLSTATE[HY000] SQLDriverConnect: -1032 [Microsoft][ODBC Microsoft Access Driver] The Microsoft Access database engine cannot open or write to the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view and write its data.
I have triple checked folder and file permissions; the file is not opened; AND no problem from the VS 2019 with IIS Express on another PC to the same file.

I think it is something about the IIS install but I have no more ideas on where to look!

Avatar of bgraves
bgraves
Flag of United States of America image

ASKER

Just some more info.
On the server, I have a program that uses oledb and it can read all the same test files on all the different paths shown above. Since oledb can read the files from the server, and since a different PC can read the files using odbc, I think the problem is somehow related to IIS and the network. It does not seem to be the file shares. Also, recall that IIS can work fine using odbc on a local copy of the file!
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It has been a very long time since I have used access on a website, but you do need to give the folder access is in both read and write permissions for the web user.
Some quick research shows you may also have to give the same privileges to the temp folder https://docs.microsoft.com/en-us/troubleshoot/aspnet/permissions-connect-a-remote-access-database

SQL Express would be a better option if you can port the data over. There would be a few minor items to fix such as wildcards in queries. At least that was the case many years ago.