1

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

https://www.microsoft.com/en-us/download/details.aspx?id=36437

they also have odbc version 1.0

https://www.microsoft.com/en-US/Download/details.aspx?id=28160

And Microsoft's walkthrough is here.

https://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 https://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.

  • Some languages have their own interfaces. What code language are you using?? That may help to answer the question. I assume PHP. – closetnoc Jun 23 '15 at 20:45
  • I am using php. Up to date version on a debian system. – MooCow Jun 23 '15 at 21:27
  • I do not know PHP, but like other languages, there may be a PHP solution. What ODBC driver are you trying to install? I mean specifically. – closetnoc Jun 23 '15 at 21:32
  • The ODBC driver I am trying to install and I will update the question with more details is ODBC Driver 11 for SQL Server. Along with that I need Unix ODBC 3.2. Now I need these files on the system in order to use php from a debian computer to request from an mssql server? – MooCow Jun 23 '15 at 21:40
  • Sorry for the links, I am only limited to two per post. Now I can use other languages? Which ones could eliminate this process? – MooCow Jun 23 '15 at 21:48
1

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,

  1. Setup Apache/IIS and PHP on the SQL server,

  2. 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).

  3. 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:

http://mssqlserver:8080/api/grab-data.php?offset=0&limit=15&sort=name,order=asc

  • Sounds like more work to me. Still, it is an option that is clever. – closetnoc Jun 24 '15 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.