PHP Doku:: IBM DB2 Funktionen -

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenIBM DB2, Cloudscape and Apache DerbyIBM DB2 Funktionen

Ein Service von Reinhard Neidl - Webprogrammierung.

IBM DB2, Cloudscape and Apache Derby

<<Vordefinierte Konstanten



IBM DB2 Funktionen


4 BenutzerBeiträge:
- Beiträge aktualisieren...
Richard dot Ablewhite at gmail dot com
11.09.2008 12:17
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:

Home Page:

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:


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:

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 = '';
$port = 50000;

$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;" .
$conn = db2_connect($conn_string, '', '');

$query = 'SELECT * FROM TABLE';
$res = db2_prepare($conn, $query);

while ($row = db2_fetch_array($res)) {
brent dot halsey at gmail dot com
11.06.2008 19:57
Spent a lot of time trying to get this to work on a 64bit box.  You'll need to make sure you set your db2 client to 64 bit mode!  If you didn't set your instance to 64bit, you can run ./db2iupdt -w64 db2instance as root to set it.  Hope this helps someone!
5.06.2008 22:38
The DB/2 Run-Time-Client can be found here:
Select the 'Runtime Client Installable for Windows' further down the page and download it.
Clients for other platform (incl. 64-Bit Windows) are also available from that page.
kfoubert at sitecrafting dot com
29.04.2008 20:00
If you wish to connect to an iSeries Server, such as an AS/400, there are two options. Installing DB2 Express-C v9.5 and purchasing DB2 Connect Personal Edition for about $500 or getting System I Access for Linux, which is a free download. Please note the server requirements for each of these. For example, we originally went with DB2 Express-C and decided upon Ubuntu 7.10, but learned about System I Access, from an IBM rep, which requires redhat package manager, after the entire server was up and running.

DB2 Express-C

DB2 Connect Personal

System I Access for Linux
NOTE: System I Access requires redhat package manager.

PHP Powered Diese Seite bei
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)