SQLServer-Ubuntu 16

From DreamFactory
Jump to: navigation, search

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

SQLSRV

  1. Install the ODBC 13 Driver (only support on Ubuntu 15 and 16)
    • $ sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/mssql-ubuntu-xenial-release/ xenial main" > /etc/apt/sources.list.d/mssqlpreview.list'
    • $ sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
    • $ sudo apt-get update
    • $ sudo apt-get install msodbcsql unixodbc-dev-utf16
  2. Install tools used for PECL
    • $ sudo apt-get install php-dev php-pear
  3. Install sqlsrv and pdo_sqlsr using PECL
    • Find the right version number
      • sqlsrv on PECL is still listed as under development so you have to specify the version number. You can get this using the below command. As of the writing of these instructions, the latest verison 4.0.6.
      • $ pecl search sqlsrv
    • Install the drivers (use the version number acquired via the previous command)
      • $ sudo pecl install pdo_sqlsrv-4.0.6
      • $ sudo pecl install sqlsv-4.0.6
  4. Enable the drivers in PHP
    • $ sudo nano /etc/php/7.0/mods-available/pdo_sqlsrv.ini
      • Edit the file so it reads: extension=pdo_sqlsrv.so
      • Save and exit the file
    • $ sudo nano /etc/php/7.0/mods-available/sqlsrv.ini
      • Edit the file so it reads: extension=sqlsrv.so
      • Save and exit the file
  5. Restart the PHP-FPM and Nginx or Restart Apache (whichever solution you're using.)
    • Nginx
      • $ sudo service php7.0-fpm restart && sudo service nginx restart
    • Apache
      • Invalid language.

        You need to specify a language like this: <source lang="html4strict">...</source>

        Supported languages for syntax highlighting:

        4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, aimms, algol68, apache, applescript, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, caddcl, cadlisp, cfdg, cfm, chaiscript, chapel, cil, clojure, cmake, cobol, coffeescript, cpp, csharp, css, cuesheet, d, dart, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, ezt, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, ispfpanel, j, java, java5, javascript, jcl, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nginx, nimrod, nsis, oberon2, objc, objeck, ocaml, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, pic16, pike, pixelbender, pli, plsql, postgresql, postscript, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, qml, racket, rails, rbs, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, rust, sas, scala, scheme, scilab, scl, sdlbasic, smalltalk, smarty, spark, sparql, sql, standardml, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vbscript, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xpp, yaml, z80, zxbasic


        $ sudo  service apache2 restart

DBLIB/FreeTDS

  1. Install the module using Apt
    • $ sudo apt-get install php-sybase
  2. Restart the PHP-FPM and Nginx or Restart Apache (whichever solution you're using.)
    • Nginx
      • $ sudo service php7.0-fpm restart && sudo service nginx restart
    • Apache
      • Invalid language.

        You need to specify a language like this: <source lang="html4strict">...</source>

        Supported languages for syntax highlighting:

        4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, aimms, algol68, apache, applescript, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, caddcl, cadlisp, cfdg, cfm, chaiscript, chapel, cil, clojure, cmake, cobol, coffeescript, cpp, csharp, css, cuesheet, d, dart, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, ezt, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, ispfpanel, j, java, java5, javascript, jcl, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nginx, nimrod, nsis, oberon2, objc, objeck, ocaml, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, pic16, pike, pixelbender, pli, plsql, postgresql, postscript, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, qml, racket, rails, rbs, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, rust, sas, scala, scheme, scilab, scl, sdlbasic, smalltalk, smarty, spark, sparql, sql, standardml, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vbscript, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xpp, yaml, z80, zxbasic


        $ sudo  service apache2 restart