开发者

How to use PHP's odbc_connect() to connect to an ODBC DSN on another host on the same LAN?

I've successfully tested a connection via PHP's odbc_connect() to a SQL Server 2005 Express database on a Windows Vista box using the following code:

$connect = odbc_connect("mssqllocal2", "", ""); 
// first arg is the System DSN that I configured on Windows

This connection works fine when executed from an instance of WAMPserver on the same Windows box. However, I'd like to be able to connect to the same ODBC DSN from another machine on the same LAN--in this parti开发者_C百科cular case, an iMac running MAMP and OS X 10.5. Ultimately, I'd like to be able to connect to the same DSN from a remote server, but that's later in the project.

Is there some syntax like this that I can use:

$connect = odbc_connect("192.168.0.55:mssqllocal2", "", "");

...or am I misunderstanding some basic tenet of ODBC data sources?


There may be some way to do a direct connection to another machine like that but you might also try to download ODBC Administrator from http://support.apple.com/downloads/ODBC_Administrator_Tool_for_Mac_OS_X and use that to configure the datasource pointing over to your Windows machine. Then you use that local DSN in your php code. So basically the network communication is configured at the ODBC level rather than in your PHP code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜