Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP connection to remote Access DB - How to do?

Status
Not open for further replies.

CHeighlund

Programmer
Jun 11, 2007
163
US
I am working on a php project that is supposed to run on our servers, but read from an Access database on an attached client. (A program on the client side is supposed to call the php program; it's presumed that if the client program exists, then the target database file exists as well.) Servers are SuSE 9.3 Linux running Apache (not sure which version), Clients are going to be running either Win98 or WinXP. The clients do not have PHP installed on them, as far as I know, only the servers.

I'm looking into the ADODB setup to make the actual connections. (I'm not sure I can guarantee the DSN parameter of the odbc_connect, and ADODB doesn't mention that. I could be mistaken here, though.) However, the tutorials I've found online all seem to indicate that the database and the php installation are on the same system. I can count on the client's IP being sent to the PHP program from the client-side program that calls the PHP one, but I'm not certain what steps I'd need to take to bridge that gap the other way, and ensure that I can connect from my server-side PHP program to the client-side database.

Does anyone know of a good tutorial for how to handle this, or have some suggestions as to how I might begin?
 
set a system DSN up on the local machine and ensure that the ports are open for incoming odbc requests from your php server. typically odbc listens on port 7210 (from memory) but i think you can specify the port in the admin panel as well.

use the system dsn as the argument for the odbc_connect. i prefer this method to the 'dsn-less' alternatives.
 
I don't think I'm going to have access to the client-side systems. That's why I'm looking at ADODB in the first place. Would the ADODB be likely to listen at port 7210 as well?
 
PHP runs exclusively on the server, so the only way you are going to get any interaction, is if your client program sends PHP the IP address to connect to, probably through a POST request like an HTMl form.

Your PHP script can then use that IP, to connect to the clients DB, provided there is nothing there to interrupt it. (firewall or similar), and perfomr the operations needed.

However this would put a strain on the network, as you are
connecting from the client to the server, then get the server to connect to the client, effectively querying across the network back to the server, to get it processed, and then sending it back to the client for display from whence it came.

And unless your client program has a web browser attached to it, I'm not sure how you want PHP to send the data back.

Wouldn't it be easier to have your client program just query the DB locally instead of all that network traffic?



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
PHP runs exclusively on the server, so the only way you are going to get any interaction, is if your client program sends PHP the IP address to connect to, probably through a POST request like an HTMl form.

Your PHP script can then use that IP, to connect to the clients DB, provided there is nothing there to interrupt it. (firewall or similar), and perfomr the operations needed.

I have been informed that I can expect the client to send the IP over. I expect the call to be part of a ShellExecute command, so that would automatically open my report inside the system's default browser. I'll simply have to design it so it looks good in IE, Firefox, and whatever else I can think of.

Wouldn't it be easier to have your client program just query the DB locally instead of all that network traffic?

Much. That's not the point. I've been specifically requested to create a PHP form to handle the output.
 
Thanks to everyone for attempting to help me out here; vacunita's remark about having the client program do the work won out. I got my boss to commit that the expected result was a presentable report in webpage form, rather than something specifically PHP driven, so the client-side program will now be generating the required HTML code in an output file, which will then be opened the same way the PHP file would have been.

Again, thank you for your gracious assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top