note 85665 added to ref.ibm-db2

From: Date: Thu, 11 Sep 2008 10:17:08 +0000
Subject: note 85665 added to ref.ibm-db2
Groups: php.notes 
Request: Send a blank email to php-notes+get-144332@lists.php.net to get a copy of this message
There seems to be a lot of good documentation for Linux users compiling PHP with DB2 support, but decent Windows notes are minimal. You do not need to install full DB2 clients to get DB2 working with DB2, all you need is the IBM Data Server Driver for ODBC, CLI, and .NET which is only 16.1 meg. You can download the driver from here: Direct Link: ftp://ftp.software.ibm.com/ps/products/db2/fixes2/englsh-us/ db2_v95/dsdriver/fp2/v9.5fp2_nt32_dsdriver_EN.exe Home Page: http://www-01.ibm.com/support/docview.wss?rs=71&uid=swg21287889 This includes both the drivers required and the PHP dll php_ibm_db2_5.2.2.dll Once installed the drivers do not setup the correct path environmental variable, so add the following to your path: C:\Program Files\IBM\IBM DATA SERVER DRIVER\bin Once thats done all should work! No massive 400meg client downloads required. Whats even better about these drivers is that you dont need to install them, you can simply copy the bin directory to any server, add it to your path and it will just work. This is great for anyone developing PHP-GTK applications, I copy the bin directory into my php-gkt2 directory and execute using the following batch script: path = %PATH%;.\IBM DATA SERVER DRIVER\bin php-win.exe %* This lets me role out lightweight DB2 client desktop apps that dont have to be installed, can just be coppied from PC to PC or ran over a network or from USB stick. As your only installing the client drivers you wont be able to catalog databases, so always use the full connection string. Here is a quick bit of code to get you started: $database = 'databasename'; $user = 'user'; $password = 'password'; $hostname = '127.0.0.1'; $port = 50000; $conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;" . "HOSTNAME=$hostname;PORT=$port;". "PROTOCOL=TCPIP;UID=$user;PWD=$password;"; $conn = db2_connect($conn_string, '', ''); $query = 'SELECT * FROM TABLE'; $res = db2_prepare($conn, $query); db2_execute($res); while ($row = db2_fetch_array($res)) { print_r($row); } ---- Server IP: 69.147.83.197 Probable Submitter: 213.175.233.9 (proxied: 200.254.1.124) ---- Manual Page -- http://www.php.net/manual/en/ref.ibm-db2.php Edit -- https://master.php.net/note/edit/85665 Del: integrated -- https://master.php.net/note/delete/85665/integrated Del: useless -- https://master.php.net/note/delete/85665/useless Del: bad code -- https://master.php.net/note/delete/85665/bad+code Del: spam -- https://master.php.net/note/delete/85665/spam Del: non-english -- https://master.php.net/note/delete/85665/non-english Del: in docs -- https://master.php.net/note/delete/85665/in+docs Del: other reasons-- https://master.php.net/note/delete/85665 Reject -- https://master.php.net/note/reject/85665 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144332) next »