views:

35

answers:

3

Hi, I am trying to write a bash or PHP script that will execute a procedure on a MS-SQL server, does anybody have pointers on how to do that in the most easiest and convenient way? The script will run on a separate Linux box.

Thanks.

A: 

Here is an example of how to execute a sproc in PHP.

MasterMax1313
+1  A: 

Installing the php mssql drivers (on Linux) can become a real pain. Just take that in mind.

We had to deal with a hosting company, which refused to install them. I ended up with a wcf service (installed as a windows service) on the sql server machine, which just invokes the sp and a simple http request from the php script. I think it is quite cool actually.

I realize that a lot of people would qualify that as an absolute overkill, but there is no doubt that an http request can be performed from a lot of devices and platforms. You don't have to install the sql drivers on every machine and platform you need to execute the sp.

That way you don't have to 'open' the sql server for remote connections, but you host wcf service (which is not more secure or anything... just a difference, some people get crazy when hear about allowing sql remote connections)

Svetlozar Angelov
Actually, in my case, installin anything on the Linux machine is easy and under my control, anything related to the MS SQL machine is not :P
AlexN
A: 

you can use mssql class for PHP.

ghostdog74