Mobile app version of vmapp.org
Login or Join
Lengel546

: Consider acceptable to use php from a linux webserver to request sql from a Microsoft SQL server? I have a linux webserver that requires grabbing data from a windows sql server. Now I read

@Lengel546

Posted in: #Linux #SqlServer

I have a linux webserver that requires grabbing data from a windows sql server. Now I read that before the linux server connects to the sql server it must have microsofts OCDB sql driver installed. Now I have am having issues trying to get the driver installed on the webserver. Can anyone point me in the right direction or to an up to date article on how to install the OCDB sql driver? Is it just better to migrate the website to a windows plateform?

The resources I have found have been unhelpful and the files provided do not even work.

Machine Details: Debian 8.xx running on VMware.

I get the driver from here label Redhat/6 driver
www.microsoft.com/en-us/download/details.aspx?id=36437
they also have odbc version 1.0
www.microsoft.com/en-US/Download/details.aspx?id=28160
And Microsoft's walkthrough is here.
technet.microsoft.com/en-us/library/hh568454(v=sql.110).aspx
Now searching through the internet, tutorials use the redhat driver above loaded onto various linux machines. The Problem comes in, is that I have to go out of my way to get the file fixes. Found here github.com/Andrewpk/Microsoft--SQL-Server--ODBC-Driver-1.0-for-Linux-Fixed-Install-Scripts. I feel that if this is the case I might as well find an entire new solution to the problem.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Lengel546

1 Comments

Sorted by latest first Latest Oldest Best

 

@Mendez628

Since you mentioned you might be open to considering an entire new solution to the problem, my preferred approach here would be instead of connecting via ODBC from your linux server to the SQL server,


Setup Apache/IIS and PHP on the SQL server,
Create an API written in PHP to perform the database queries required via ODBC but executed directly on the SQL server, returning the dataset in the HTTP response (this could be in XML or JSON format or as a PHP serialized object for example).
On your linux server instead of trying to run database queries, get your dataset by requesting the relevant URL from the webserver service running on your SQL server, specifying any parameters required for preparing the SQL query along the QUERY_STRING.


For example, if your SQL Server host name was mssqlserver, the webserver service was running on port 8080, your API script was in a folder called api and named grab-data.php, and you would like the first 15 records sorted by name in ascending order, you might be using a URL similar to:
mssqlserver:8080/api/grab-data.php?offset=0&limit=15&sort=name,order=asc

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme