IBM DB2 Installation

From DreamFactory
Jump to: navigation, search

Notes

Using DB2 with PHP potentially requires the installation of 2 drivers, ibm_db2, and pdo_ibm. The following instructions are intended as a guide and are not exhaustive in their scope. Knowledge of compiling applications is necessary for this process. DB2 is only supported on Linux due to the lack of available drivers for other platforms.

Linux, Manual DreamFactory Install (via Github)

Debian/Ubuntu/Mint/Etc

IBM_DB2

  1. Get the prerequisites
    • $ sudo apt-get install build-essential php5-dev php-pear ksh zip
  2. Download the DS Driver package from IBM (login required, free.) https://www-01.ibm.com/marketing/iwm/iwm/web/preLogin.do?source=swg-idsdpds
  3. Extract the DS Driver package to a directory of your choosing. In the examples /opt/ibm is used for this.
    • $ sudo mkdir /opt/ibm
    • $ sudo tar -zxvf ibm_data_server_driver_package_linuxx64_v10.5.tar.gz -C /opt/ibm
  4. Change directory to the extracted files and make the installer executable
    • $ cd /opt/ibm/dsdriver
    • $ sudo chmod +x installDriver
  5. Install the DS Driver package
    • $ sudo ksh installDriver
    • You should see feed back on the screen indicating successful installation. If you do not, please troubleshoot and resolve before proceeding
  6. Build and install the module with PECL. The installer will ask you for the DB2 Installation Directory, which will be /opt/ibm/dsdriver
    • $ sudo pecl install ibm_db2
    • DB2 Installation Directory? : /opt/ibm/dsdriver
  7. Enable the module in PHP
    • Use your text editor of choice (vim in this example) to add an ibm_db2.ini file
    • $ sudo vim /etc/php5/mods-available/ibm_db2.ini
    • The file should have a single line
    • extension=ibm_db2.so
    • Save the file. Then enable the module the php enmod
    • $ sudo php5enmod ibm_db2
  8. Confirm installed and working in PHP
    • $ php -m
    • You should not see any errors at the top of the module list, and ibm_db2 should be in the module list.

PDO_IBM

  • This process requires you to configure and compile the driver source code, and has some possible steps that will be unique to each system. Please read through the instructions carefully.
  • For the sake of simplicity and avoiding permissions issues, it is recommended to start in your home directory ($ cd ~) before performing these instructions.
  1. Download the latest source package from PECL (version 1.3.4 as of this writing.)
  2. Extract the file
    • $ tar -zxvf PDO_IBM-1.3.4.tgz
  3. Change into the extracted directory and phpize.
    • $ cd PDO_IBM-1.3.4
    • $ phpize
  4. Configure the package
    • In some environments configure may fail because it looks for the php_pdo_driver.h file in the wrong location. In our test environment (Ubuntu 14.04) this was resolved by first making a symlink from include/php5 folder to include/php.
      • $ sudo ln -s /usr/include/php5 /usr/include/php
    • $ ./configure --with-pdo-ibm=/opt/ibm/dsdriver/lib
  5. Compile the package and install
    • $ make
    • $ sudo make install
  6. Enable the module in PHP
    • Use your text editor of choice (I use vim) to add a pdo_ibm.ini file
    • $ sudo vim /etc/php5/mods-available/pdo_ibm.ini
    • The file should have a single line
    • extension=pdo_ibm.so
    • Save the file. Then enable the module the php enmod
    • $ sudo php5enmod pdo_ibm
  7. Confirm installed and working in PHP
    • $ php -m
    • You should not see any errors at the top of the module list, and pdo_ibm should be in the module list.

Linux, Bitnami Install/VM

PDO_IBM

  1. Get the prerequisites
    • IBM recommends the KSH shell for installing the dsdriver package. Debian example below:
    • $ sudo apt-get install build-essential ksh
  2. Download the DS Driver package from IBM (login required, free.) https://www-01.ibm.com/marketing/iwm/iwm/web/preLogin.do?source=swg-idsdpds
  3. Extract the DS Driver package to a directory of your choosing. In the examples /opt/ibm is used for this.
    • $ sudo mkdir /opt/ibm
    • $ sudo tar -zxvf ibm_data_server_driver_package_linuxx64_v10.5.tar.gz -C /opt/ibm
  4. Change directory to the extracted files and make the installer executable
    • $ cd /opt/ibm/dsdriver
    • $ sudo chmod +x installDriver
  5. Install the DS Driver package
    • $ sudo ksh installDriver
    • You should see feed back on the screen indicating successful installation. If you do not, please troubleshoot and resolve before proceeding
  6. Enable the pdo_ibm.so module in php.ini. Php.ini will be in a different location depending on where you installed the Bitnami package. In the examples, we will assume the Bitnami VM, which has it located at /opt/bitnami/php/etc/php.ini, and we will use vim to edit. You can use any text editor you prefer
    • $ sudo vim /opt/bitnami/php/bin/php
    • Locate the line that says
      • ;extension=pdo_ibm.so
    • Uncomment the line by removing the semicolon (;)
    • Save the file.
  7. Set the LD path in the setenv.sh file.
    • $ sudo vim /opt/bitnami/scripts/setenv.sh
    • Add this text to the end of the file
    • 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


      LD_LIBRARY_PATH=/opt/ibm/dsdriver/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
    • Save the sentenv.sh file
  1. Restart the Bitnami stack
    • $ sudo /opt/bitnami/ctlscript.sh restart
  2. Confirm installed and working in PHP
    • $ sudo /opt/bitnami/php/bin/php -m
    • You should not see any errors at the top of the module list, and pdo_ibm should be in the module list.