faqts : Computers : Programming : Languages : PHP : Database Backed Sites : ODBC

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

77 of 89 people (87%) answered Yes
Recently 8 of 10 people (80%) answered Yes


IBM DB2 Connections to PHP under linux.

Oct 19th, 2000 09:54
Aslak Berby,

To connect IBM DB2 to PHP under linux (UNIX in general) is quite simple.
First you must install the DB2 including the software develooper kit. 
(Is on teh default instalation for Linix.)
Compile PHP with the --with-ibm-db2=/your/path/to/the/db2inst1/sqllib 
option (for example: "./configure --with-pgsql --with-ibm-
db2=/disks/8gig/home/db2ins71/sqllib --without-gd --enable-ftp --with-
apache=../apache_1.3.12  --enable-track-vars" then compile the Apache 
server like usual.
In PHP use the odbc_* function calls to do the rest.
$Query_ID = odbc_do($Link_ID,"SELECT a,b FROM some_sheame.some_table");
  print("A:".odbc_result($Query_ID,"a")." B:".odbc_result
odbc_free_result($Query_ID );
PHP also instals a DB class hirachy whitch I recommend. It's default 
locatet at:/usr/local/lib/php/DB.php 
Good luck