IBM DB2 Installation

From DreamFactory
Jump to: navigation, search
(IBM_DB2)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Notes==
+
==Free DB2 Instance==
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)==
+
IBM offers a free DB2 instance which can be used for development purposes. Create an account at [[https://console.bluemix.net/dashboard/apps/ IBM Cloud]] to create an instance.
===Debian/Ubuntu/Mint/Etc===
+
====IBM_DB2====
+
#Get the prerequisites
+
#*<source lang=bash>$ sudo apt-get install build-essential php5-dev php-pear ksh</source>
+
#Download the DS Driver package from IBM (login required, free.) https://www-01.ibm.com/marketing/iwm/iwm/web/preLogin.do?source=swg-idsdpds
+
#Extract the DS Driver package to a directory of your choosing. In the examples /opt/ibm is used for this.
+
#*<source lang=bash>$ sudo mkdir /opt/ibm</source>
+
#*<source lang=bash>$ sudo tar -zxvf ibm_data_server_driver_package_linuxx64_v10.5.tar.gz -C /opt/ibm</source>
+
#Change directory to the extracted files and make the installer executable
+
#*<source lang=bash>$ cd /opt/ibm/dsdriver</source>
+
#*<source lang=bash>$ sudo chmod +x installDriver</source>
+
#Install the DS Driver package
+
#*<source lang=bash>$ sudo ksh installDriver</source>
+
#*You should see feed back on the screen indicating successful installation. If you do not, please troubleshoot and resolve before proceeding
+
#Build and install the module with PECL. The installer will ask you for the DB2 Installation Directory, which will be /opt/ibm/dsdriver
+
#*<source lang=bash>$ sudo pecl install ibm_db2</source>
+
#*<source lang=bash>DB2 Installation Directory? : /opt/ibm/dsdriver</source>
+
#Enable the module in PHP
+
#*Use your text editor of choice (vim in this example) to add an ibm_db2.ini file
+
#*<source lang=bash>$ sudo vim /etc/php5/mods-available/ibm_db2.ini</source>
+
#*The file should have a single line
+
#*<source lang=bash>extension=ibm_db2.so</source>
+
#*Save the file. Then enable the module the php enmod
+
#*<source lang=bash>$ sudo php5enmod ibm_db2</source>
+
#Confirm installed and working in PHP
+
#*<source lang=bash>$ php -m</source>
+
#*You should not see any errors at the top of the module list, and ibm_db2 should be in the module list.
+
  
====PDO_IBM====
+
==Notes==
*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.
+
DB2 access is accomplished using the PDO_IBM driver. Recently DreamFactory patched this driver to ensure PHP 7 compatibility. Please install using this GitHub readme as a guide [https://github.com/dreamfactorysoftware/PDO_IBM-1.3.4-patched PDO_IBM Patched]
*For the sake of simplicity and avoiding permissions issues, it is recommended to start in your home directory (<code>$ cd ~</code>) before performing these instructions.
+
#Download the latest source package from PECL (version 1.3.4 as of this writing.)
+
#*https://pecl.php.net/package/PDO_IBM
+
#Extract the file
+
#*<source lang=bash>$ tar -zxvf PDO_IBM-1.3.4.tgz</source>
+
#Change into the extracted directory and phpize.
+
#*<source lang=bash>$ cd PDO_IBM-1.3.4</source>
+
#*<source lang=bash>$ phpize</source>
+
#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.
+
#**<source lang=bash>$ sudo ln -s /usr/include/php5 /usr/include/php</source>
+
#*<source lang=bash>$ ./configure --with-pdo-ibm=/opt/ibm/dsdriver/lib</source>
+
#Compile the package and install
+
#*<source lang=bash>$ make</source>
+
#*<source lang=bash>$ sudo make install</source>
+
#Enable the module in PHP
+
#*Use your text editor of choice (I use vim) to add a pdo_ibm.ini file
+
#*<source lang=bash>$ sudo vim /etc/php5/mods-available/pdo_ibm.ini</source>
+
#*The file should have a single line
+
#*<source lang=bash>extension=pdo_ibm.so</source>
+
#*Save the file. Then enable the module the php enmod
+
#*<source lang=bash>$ sudo php5enmod pdo_ibm</source>
+
#Confirm installed and working in PHP
+
#*<source lang=bash>$ php -m</source>
+
#*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==
+
For concrete example see the [[../../../APT/Ubuntu_16.04/Modules/IBM DB2_Ubuntu_16| Ubuntu 16.04]] instructions.
===PDO_IBM===
+
*Notes: The location of the php.ini and other files will vary depending on how the Bitnami package was installed. In this example we will assume the Bitnami VM, which has all of the relevant files in /opt/bitnami. We will be using Vim to edit text files, but you can use any preferred editor.
+
#Get the prerequisites
+
#*IBM recommends the KSH shell for installing the dsdriver package. Debian example below:
+
#*<source lang=bash>$ sudo apt-get install build-essential ksh</source>
+
#Download the DS Driver package from IBM (login required, free.) https://www-01.ibm.com/marketing/iwm/iwm/web/preLogin.do?source=swg-idsdpds
+
#Extract the DS Driver package to a directory of your choosing. In the examples /opt/ibm is used for this.
+
#*<source lang=bash>$ sudo mkdir /opt/ibm</source>
+
#*<source lang=bash>$ sudo tar -zxvf ibm_data_server_driver_package_linuxx64_v10.5.tar.gz -C /opt/ibm</source>
+
#Change directory to the extracted files and make the installer executable
+
#*<source lang=bash>$ cd /opt/ibm/dsdriver</source>
+
#*<source lang=bash>$ sudo chmod +x installDriver</source>
+
#Install the DS Driver package
+
#*<source lang=bash>$ sudo ksh installDriver</source>
+
#*You should see feed back on the screen indicating successful installation. If you do not, please troubleshoot and resolve before proceeding
+
#Enable the pdo_ibm.so module in php.ini.
+
#*<source lang=bash>$ sudo vim /opt/bitnami/php/bin/php.ini</source>
+
#*Locate the line that says
+
#**<source lang=bash>;extension=pdo_ibm.so</source>
+
#*Uncomment the line by removing the semicolon (;)
+
#*Save the file.
+
#Set the LD path in the setenv.sh file.
+
#*<source lang=bash>$ sudo vim /opt/bitnami/scripts/setenv.sh</source>
+
#*Add this text to the end of the file
+
#*<source lang=bash>LD_LIBRARY_PATH=/opt/ibm/dsdriver/lib:$LD_LIBRARY_PATH</source>
+
#*<source lang=bash>export LD_LIBRARY_PATH</source>
+
#*Save the sentenv.sh file
+
#Restart the Bitnami stack
+
#*<source lang=bash>$ sudo /opt/bitnami/ctlscript.sh restart</source>
+
#Confirm installed and working in PHP
+
#*<source lang=bash>$ sudo /opt/bitnami/php/bin/php -m</source>
+
#*You should not see any errors at the top of the module list, and pdo_ibm should be in the module list.
+

Latest revision as of 07:37, 19 July 2022

Free DB2 Instance

IBM offers a free DB2 instance which can be used for development purposes. Create an account at [IBM Cloud] to create an instance.

Notes

DB2 access is accomplished using the PDO_IBM driver. Recently DreamFactory patched this driver to ensure PHP 7 compatibility. Please install using this GitHub readme as a guide PDO_IBM Patched

For concrete example see the Ubuntu 16.04 instructions.