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.

Shiz
  • 695
  • 10
  • 27
  • 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? – ADyson Nov 04 '19 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. – Shiz Nov 05 '19 at 00: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? – Nico Haase Nov 06 '19 at 09: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 – Shiz Nov 06 '19 at 09:23

1 Answers1

1

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

Dharman
  • 30,962
  • 25
  • 85
  • 135
Honk der Hase
  • 2,459
  • 1
  • 14
  • 26
  • 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. – Shiz Nov 13 '19 at 09:30