I've been programming in VB for not quite two years. Java for about one year. And now my company wants to develop their first PHP application, and I seem to be the guy who gets to do all the "new" language projets. We have 9 RPG programmers, and then myself, the object oriented programmer. So when I come accross as a complete novice with my question, I do apologize.
Let me explain my situation, so that my question is very clear
We have an (DB2) IBM ISeries AS400, that runs Apache server, which will host our PHP projects. For development, I run windows xp, using zend studio with a local zend apache server on my PC. I want to connect to the DB2 database, and have found the "adodb/adodb.inc.php" class library to be usable.
By using the below statement, I am able to connect to and query the DB2 database:
Code: Select all
//Variables
define("DB_SERVER", "AS400");
define("DB_HOST", "192.168.1.2");
define("DB_PORT", "");
define("DB_USER", "DB_USER");
define("DB_PASS", "TEST_PASS");
define("MYLIBRARY", "TESTLIB");
define("CONNECTION_STRING", "DRIVER={iSeries Access ODBC Driver};SYSTEM=".DB_HOST.";DATABASE=".DB_SERVER.";PROTOCOL=TCPIP;PORT=".DB_PORT.";");
...
include('../adodb/adodb.inc.php');
$db = ADONewConnection('odbc');
//if able to connect
if ($db->Connect(CONNECTION_STRING,DB_USER,DB_PASS)){
//execute sql statement
$rs = $db->Execute($sql);
//if contains rows
if ($rs) {
//while more rows
while (!$rs->EOF) {
//for each column in row
for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++)
{echo $rs->fields[$i];}
//next row
$rs->MoveNext();
}
}
}
I appreciate any help!
Thanks,