SQLServer

From DreamFactory
Jump to: navigation, search
(Created page with "There are two different drivers you can use to connect to Microsoft SQL. We '''highly recommend''' the sqlsrv driver over dblib/freetds. However dblib/freetds is still support...")
 
(SQLSRV)
Line 1: Line 1:
 
There are two different drivers you can use to connect to Microsoft SQL. We '''highly recommend''' the sqlsrv driver over dblib/freetds. However dblib/freetds is still supported.
 
There are two different drivers you can use to connect to Microsoft SQL. We '''highly recommend''' the sqlsrv driver over dblib/freetds. However dblib/freetds is still supported.
 
=== SQLSRV ===
 
=== SQLSRV ===
 +
'''Note''': These instructions were adapted from the official Microsoft PHP SQLSRV repo on Github[1]. Please consult this repo for additional information about this driver and its implementation options.
  
 +
# Install the ODBC 13 Driver
 +
#* <source lang="bash">$ sudo sh -c 'curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo'</source>
 +
#* If the unixodbc-utf16 packages are already installed
 +
#** <source lang="bash">$ sudo yum remove unixODBC-utf16 unixODBC-utf16-devel</source>
 +
#* <source lang="bash">$ sudo ACCEPT_EULA=Y yum install msodbcsql unixODBC-devel</source>
 +
# Install tools used for PECL
 +
#* <source lang="bash">$ sudo yum install php71w-devel php71w-pear</source>
 +
#* <source lang="bash">$ sudo yum groupinstall 'Development Tools'</source>
 +
# Install sqlsrv and pdo_sqlsr using PECL
 +
#* sqlsrv on PECL is has been released from development to stable. As of the writing of these instructions, the latest verison 4.3.0.
 +
#** <source lang="bash">$ sudo pecl install sqlsrv</source>
 +
#** <source lang="bash">$ sudo pecl install pdo_sqlsrv</source>
 +
# Create the ini files
 +
#* <source lang="bash">$ sudo sh -c 'echo "extension=sqlsrv.so" > /etc/php.d/sqlsrv.ini'</source>
 +
#* <source lang="bash">$ sudo sh -c 'echo "extension=pdo_sqlsrv.so" > /etc/php.d/pdo_sqlsrv.ini'</source>
 +
# Restart PHP-FPM or Apache
  
 
=== DBLIB/FreeTDS ===
 
=== DBLIB/FreeTDS ===

Revision as of 16:31, 20 October 2017

There are two different drivers you can use to connect to Microsoft SQL. We highly recommend the sqlsrv driver over dblib/freetds. However dblib/freetds is still supported.

SQLSRV

Note: These instructions were adapted from the official Microsoft PHP SQLSRV repo on Github[1]. Please consult this repo for additional information about this driver and its implementation options.

  1. Install the ODBC 13 Driver
    • $ sudo sh -c 'curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo'
    • If the unixodbc-utf16 packages are already installed
      • $ sudo yum remove unixODBC-utf16 unixODBC-utf16-devel
    • $ sudo ACCEPT_EULA=Y yum install msodbcsql unixODBC-devel
  2. Install tools used for PECL
    • $ sudo yum install php71w-devel php71w-pear
    • $ sudo yum groupinstall 'Development Tools'
  3. Install sqlsrv and pdo_sqlsr using PECL
    • sqlsrv on PECL is has been released from development to stable. As of the writing of these instructions, the latest verison 4.3.0.
      • $ sudo pecl install sqlsrv
      • $ sudo pecl install pdo_sqlsrv
  4. Create the ini files
    • $ sudo sh -c 'echo "extension=sqlsrv.so" > /etc/php.d/sqlsrv.ini'
    • $ sudo sh -c 'echo "extension=pdo_sqlsrv.so" > /etc/php.d/pdo_sqlsrv.ini'
  5. Restart PHP-FPM or Apache

DBLIB/FreeTDS