3

I have php program that requires MS Access, so I had to use odbc. Locally, using DSN it was working fine:

$db = new PDO("odbc:MyDSN");

I also have no problem when I put the php and odbc at the server and access it remotely:

$db = new PDO("odbc:DRIVER=MDBTools; DBQ=Data.mdb;");

But I can't afford to use it for some reason. I want to put php on the server together with the database but I want to place odbc (or the odbc driver) on the client, something like this:

$db = new PDO("odbc:{127.0.0.1\foo\bar\odbc.ini}; DBQ=Data.mdb;");

I can't seems to work with it for a while. I'm using Ubuntu 64bit as server, and Windows 7 as client

UPDATE 1: I found a way to do it, but it needs to modify the PHP itself (Classes,structure,etc.) I hope someone can help me to get alternative solutions

UPDATE 2: Another solution, but requires third party software.

4
  • 1) Does the server actually have access to this file on the client? 2) 127.0.0.1, when executed on the server, will resolve to the server itself, not the client. 3) I can't find anywhere which says your last example is actually a valid connection string for ODBC - can you point to some documentation? 4) Why do you even want to do this? What's the problem with putting it on the server? 5) Access is a terrible choice of backend for a web application. Can't you migrate to some other database platform? Commented Nov 4, 2019 at 10:13
  • 1 & 2 yes. 3) yes there's no such thing in every documentation, I don't even know if that line of code will work. 4) well.. uh,.. 5) I hope I can but that Access is bundled with software, the web app must access it both. Commented Nov 5, 2019 at 0:33
  • Can you share more details? "Can't afford to use it" sounds pretty vague, what does that mean? And if you found a way to solve your problem, why not use it? What exactly does that solution cover that is not present in vanilla PHP? Commented Nov 6, 2019 at 9:03
  • @NicoHaase The solution I found requires to modify PHP5 or PHP7 itself (those DLLs or .SO files) which is bad, second solution requires 3rd party program, but I don't want to rely in such program. The reason, the least I can say is I'm experimenting the possibilities like this and for the benefit of server Commented Nov 6, 2019 at 9:23

1 Answer 1

1
+50

But I can't afford to use it for some reason. I want to put php on the server together with the database but I want to place odbc (or the odbc driver) on the client, something like this:

The driver must be loaded by PHP, which is the "client" in this scenario. Means, you'll have to find an appropriate MSAccess ODBC driver for Ubuntu.

Check this SO thread: ODBC connection to MS-Access on Ubuntu

Sign up to request clarification or add additional context in comments.

1 Comment

Of course I know all of that, it just doesn't work remotely... anyway the bounty is a waste, I'll give it to you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.