I have the following setup:
ubuntu 6.10 - LAMP configuration
apache2
php5
libphp-adodb 4.72
db2-client for linux -
ibm-db2adt81 8.1.2-137 base application development tools
ibm-db2cliv81 8.1.2-137 base client support
(lots more ibm-db2 stuff)

Everything has been installed as binaries...nothing has been specially configured. I can write a select on the command line to obtain data from an ibm db2 udb database running on a different server, but I cannot get php code working to do the same select. I have tried following instructions on a multitude of different sites. Nothing has worked.

My code:
<?php
include ('/usr/share/php/adodb/adodb.inc.php');
$DB = ADONewConnection('odbc_db2');
$DB->debug=1;
$DB->Connect ("db2server", "userid", "password", "databasename");
$rs = $DB->Execute("select field1, field2 from schema.tablename");
?>

My results:
db2server: Missing extension for odbc
(db2): select field1, field2 from schema.tablename
Fatal error: Call to undefined function odbc_exec() in /usr/share/php/adodb/drivers/adodb-odbc.inc.php on line 530

Is there anyone out there who is familiar with all these different software pieces and the interface? Could this be a php.ini configuration issue?

    Did you recompile PHP with the "--with-ibm-db2" option?

      No, I have only installed binaries using the Synaptic package manager. Is there any way to tell if the binary I installed was compiled with ibm-db2? It was my understanding from the doc that I only had to recompile php if I installed the official IBM written "db2_extension". I decided to try the libphp-adodb instead because I could easily install it without recompiling anything (according to everything I've read).

        Well, I'm no expert in Unix or ODBC. All I know is that the adodb class you have needs to use odbc_exec(), which isn't defined presumably since you didn't compile PHP with ODBC support.

          Write a Reply...