Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's how I connect to MS SQL servers from a LAMP (Ubuntu) stack:</p> <p>/etc/odbc.ini</p> <pre><code># Define a connection to a Microsoft SQL server # The Description can be whatever we want it to be. # The Driver value must match what we have defined in /etc/odbcinst.ini # The Database name must be the name of the database this connection will connect to. # The ServerName is the name we defined in /etc/freetds/freetds.conf # The TDS_Version should match what we defined in /etc/freetds/freetds.conf [mssql] Description = MSSQL Server Driver = freetds Database = XXXXXX ServerName = MSSQL TDS_Version = 8.0 </code></pre> <p>/etc/odbcinst.ini</p> <pre><code># Define where to find the driver for the Free TDS connections. [freetds] Description = MS SQL database access with Free TDS Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so Setup = /usr/lib/i386-linux-gnu/odbc/libtdsS.so UsageCount = 1 </code></pre> <p>/etc/freetds/freetds.conf</p> <pre><code># The basics for defining a DSN (Data Source Name) # [data_source_name] # host = &lt;hostname or IP address&gt; # port = &lt;port number to connect to - probably 1433&gt; # tds version = &lt;TDS version to use - probably 8.0&gt; # Define a connection to the Microsoft SQL Server [mssql] host = XXXXXX port = 1433 tds version = 8.0 </code></pre> <p>And here's the PHP code:</p> <pre><code>$con = new PDO('dblib:host=mssql;dbname=MyDB', 'domain\username', 'password'); </code></pre> <p>You may need to tweak things a bit for your OS. To install the necessary software on Ubuntu I did something like this:</p> <pre><code>sudo apt-get install php5-odbc php5-sybase tdsodbc </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload