Database Knowledge Base
Search:     Advanced search
Browse by category:
Glossary | Contact Us

IBM DB2 Connections to PHP under linux.

Add comment
Views: 852
Votes: 2
Comments: 36
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.

Example:
$Link_ID=odbc_pconnect("databasename","user","Password");
$Query_ID = odbc_do($Link_ID,"SELECT a,b FROM some_sheame.some_table");
$i=1;
$res=odbc_fetch_row($Query_ID,$i);
while($res)
{
  print("A:".odbc_result($Query_ID,"a")." B:".odbc_result
($Query_ID,"b")."<BR>");
  $res=odbc_fetch_row($Query_ID,$i);
}
odbc_free_result($Query_ID );
odbc_Close($Link_ID);

PHP also instals a DB class hirachy whitch I recommend. It's default
locatet at:/usr/local/lib/php/DB.php
Reference: http://www.faqts.com/knowledge_base/view.phtml/aid/6283/fid/14
Showing: 1-20 of 36    »»
Comments

31 Dec, 1969   |   Guest
sql database design


31 Dec, 1969   |   Guest
cloud database


31 Dec, 1969   |   Guest
online sql classes


31 Dec, 1969   |   Guest
database management system


31 Dec, 1969   |   Guest
sql server functions


31 Dec, 1969   |   Guest
microsoft sql server 2008 express


31 Dec, 1969   |   Guest
sql server 2008 sp2


31 Dec, 1969   |   Guest
database development


31 Dec, 1969   |   Guest
what is database software


31 Dec, 1969   |   Guest
sql server books online


31 Dec, 1969   |   Guest
free sql server


31 Dec, 1969   |   Guest
sql server 2005


31 Dec, 1969   |   Guest
online sql course


31 Dec, 1969   |   Guest
advanced sql queries


31 Dec, 1969   |   Guest
free sql server


31 Dec, 1969   |   Guest
access dbms


31 Dec, 1969   |   Guest
relational database software


31 Dec, 1969   |   Guest
microsoft sql server 2005


31 Dec, 1969   |   Guest
data base


31 Dec, 1969   |   Guest
sql server encryption


Showing: 1-20 of 36    »»


Add comment

Others in this Category
document What is Data Mapping
document What is an Ad Hoc Query?



RSS