How do you connect to a mapped MS access database?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How do you connect to a mapped MS access database?

Postby failing_solutions » 12. June 2013 16:59

I'm running Xampp on my local PC and I have a network drive mapped to Y.

I'm trying to pull data from a MS Access .mdb and write it to a text file so I can then import it into my local mySql database.

If I try
Code: Select all
try {
    $dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=cerfs1/f:/orsdata/ORSDATA.mdb;Uid=; Pwd=;");
    }
catch (PDOException $e)
    {

It fails. Where cerfs1 is the name of the server f: is the actual server drive letter /orsdata is the server folder and orsdata.mdb is the database.
I have tried every variation I can think of to get the drive but I am unable to do so and receive various errors.

If I copy the database and put it in c:/xampp/htdocs/mywebsite/orsdata.mdb I can read from it just fine.

Is there some special trick to escape the local Xampp environment that I'm not aware of?

Here are some examples of the errors I receive:
Dbq=//cerfs1/orsdata/ORSDATA.mdb -> SQLSTATE[HY000] SQLDriverConnect: -1811 [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.

Dbq=//cerfs1/f:/orsdata/ORSDATA.mdb ->SQLSTATE[HY024] SQLDriverConnect: -1023 [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.

Dbq=cerfs1/f:/orsdata/ORSDATA.mdb ->SQLSTATE[HY000] SQLDriverConnect: -1044 [Microsoft][ODBC Microsoft Access Driver] Not a valid file name.

Dbq=10.50.10.12/f:/orsdata/ORSDATA.mdb -> SQLSTATE[HY000] SQLDriverConnect: -1044 [Microsoft][ODBC Microsoft Access Driver] Not a valid file name.

//Shared Drive is Y which is mapped to F:/orsdata

Dbq=Y:/ORSDATA.mdb -> SQLSTATE[HY024] SQLDriverConnect: -1023 [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.

Any thoughts, ideas is very much appreciated.
failing_solutions
 
Posts: 4
Joined: 12. June 2013 16:49
XAMPP Version: 1.8.3-3
Operating System: windows 7

Re: How do you connect to a mapped MS access database?

Postby Altrea » 12. June 2013 17:12

use backslashes
double the backslashes
use the correct share name
be sure the server user xampp is running with has permissions to read the file

example:
Code: Select all
$dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=\\\\hostname\\share\\folder\\db.mdb;Uid=user; Pwd=pass;");
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6829
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: Windows 10 Pro x64

Re: How do you connect to a mapped MS access database?

Postby failing_solutions » 12. June 2013 18:32

Thank you for the response.

Share name is orsdata
Mapped drive is Y
Permissions is Full Control User level Admin (local)

Actual server location is [10.50.10.12] F:/orsdata/ORSDATA.mdb

ping cerfs1:
reply from 10.50.10.12 bytes=32 time<1ms TTL=128
reply from 10.50.10.12 bytes=32 time<1ms TTL=128
reply from 10.50.10.12 bytes=32 time<1ms TTL=128
reply from 10.50.10.12 bytes=32 time<1ms TTL=128

Dbq=\\\\cerfs1\\F:\\ORSDATA\\ORSDATA.mdb -> SQLSTATE[HY024] SQLDriverConnect: -1023 [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.
(\\\\server\\drive\\folder\\.db)

Dbq=\\cerfs1\F:\ORSDATA\ORSDATA.mdb -> SQLSTATE[HY000] SQLDriverConnect: -1044 [Microsoft][ODBC Microsoft Access Driver] Not a valid file name.
(\\server\drive\folder\.db)

Dbq=\\cerfs1\Y:\ORSDATA.mdb; -> SQLSTATE[HY000] SQLDriverConnect: -1044 [Microsoft][ODBC Microsoft Access Driver] Not a valid file name.
(\\server\share\.db)

Dbq=\\\\cerfs1\\Y:\\ORSDATA.mdb; -> SQLSTATE[HY024] SQLDriverConnect: -1023 [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.
(\\\\server\\share\\.db)

Dbq=Y:\\ORSDATA.mdb; -> SQLSTATE[HY024] SQLDriverConnect: -1023 [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.
(share\\.db)

Just to play it safe use the IP as well.

Dbq=\\\\10.50.10.12\\F:\\ORSDATA\\ORSDATA.mdb; -> SQLSTATE[HY024] SQLDriverConnect: -1023 [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.
(\\\\IP\\drive\\folder\\.db)

Dbq=\\10.50.10.12\F:\ORSDATA\ORSDATA.mdb; -> SQLSTATE[HY000] SQLDriverConnect: -1044 [Microsoft][ODBC Microsoft Access Driver] Not a valid file name.
(\\IP\drive\folder\.db)

Dbq=\\10.50.10.12\Y:\ORSDATA.mdb; -> SQLSTATE[HY000] SQLDriverConnect: -1044 [Microsoft][ODBC Microsoft Access Driver] Not a valid file name.
(\\IP\share\.db)

Dbq=\\10.50.10.12\orsdata\ORSDATA.mdb; -> SQLSTATE[HY024] SQLDriverConnect: -1023 [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.
(\\IP\sharename\.db)

Dbq=\\\\10.50.10.12\\Y:\\ORSDATA.mdb;
-> SQLSTATE[HY024] SQLDriverConnect: -1023 [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.
(\\\\IP\\share\\.db)

Dbq=\\\\10.50.10.12\\orsdata\\ORSDATA.mdb; -> SQLSTATE[HY000] SQLDriverConnect: -1811 [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.
(\\\\IP\\\sharename\\.db)


Any further help would be appreciated.
failing_solutions
 
Posts: 4
Joined: 12. June 2013 16:49
XAMPP Version: 1.8.3-3
Operating System: windows 7

Re: How do you connect to a mapped MS access database?

Postby failing_solutions » 13. June 2013 14:08

I wanted to follow up in case somebody else runs into this issue. (I READ A CRAP TON OF POST ABOUT THIS PROBLEM).

By default Xampp will install itself as a local service. And try to log on as "Local System" which likely will not have writes to access LAN drives.

To fix this problem:
1. run services.msc
2. Find Service Apache2.2 and right click it and go to properties
3. Switch to the Log On Tab
4. Select "This account:"
5. Click the Browse Button then -> Entire Directory
6. Select Your LAN and click OK
7. In the Text Area box under the "Enter the object name to select(examples):" type in a network account name like the one you use to log into the network
8. Click Check Names button. If this populates a name in the text area then you have a valid name if not try again. Then click Okay.
9. Fill in the Password / Confirm Password text inputs and click apply.
10. You will be warned you need to restart Apache. Click Okay
11. Back on the Services Windows you can single click the Apache2.2 service and then click restart. If for any reasons this fails just reboot your computer.

You now will have access to network drives.

Hope this helps somebody!
failing_solutions
 
Posts: 4
Joined: 12. June 2013 16:49
XAMPP Version: 1.8.3-3
Operating System: windows 7

Re: How do you connect to a mapped MS access database?

Postby Altrea » 13. June 2013 14:18

failing_solutions wrote:By default Xampp will install itself as a local service.

Thats not correct. The installer will ask you if you want to register any single component as service. The .zip, .7z and portable versions will not prompt or install any service exept the user check the svc checkfields in the XAMPP control panel.

failing_solutions wrote:And try to log on as "Local System" which likely will not have writes to access LAN drives.

Thats why i wrote "be sure the server user xampp is running with has permissions to read the file"
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6829
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: Windows 10 Pro x64

Re: How do you connect to a mapped MS access database?

Postby failing_solutions » 13. June 2013 14:45

Thanks for the follow up. I've installed Xampp about 10-15 times but don't remember or didn't bother to look for how to install, thanks for the clarification.

Thats why i wrote "be sure the server user xampp is running with has permissions to read the file"

Yep, you were correct were the problem could have been but didn't help me solve it, I was hoping my post would do that for others.

Thank you
failing_solutions
 
Posts: 4
Joined: 12. June 2013 16:49
XAMPP Version: 1.8.3-3
Operating System: windows 7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 46 guests