Short version: I’m trying to figure out if it’s possible to use AR or QueryBuilder using ibm db2 functions.
Confused? Here’s the long version:
We use an IBM iSeries machine (as/400) and run Zend server 6 on it.
The ONLY way I’ve found that allows you to connect to db2 using php is with this:
db2_connect ( string $database , string $username , string $password , [ array $options ] )
An example in action:
db2_connect($HOST, $UID, $PWD, array( 'i5_naming' => DB2_I5_NAMING_ON, 'i5_lib' => 'HMS' ))
Now this connection works just fine and that’s great. What’s not so great is that I have to code all the sql queries the hard way.
I’ve dug around the web for some kind of way to provide a db component that yii can use:
'db2' => array(
'connectionString' => 'ibm:DRIVER={IBM DB2 ODBC DRIVER};DATABASE=database;HOSTNAME=hostname;PORT=port;PROTOCOL=TCPIP;',
//or//'connectionString' => 'odbc:DRIVER={IBM DB2 ODBC DRIVER};DATABASE=database;HOSTNAME=hostname;PORT=port;PROTOCOL=TCPIP;',
'username' => 'username',
'password' => 'password',
'class' => 'ext.yiidb2.CIbmDB2Connection',
),
The odbc can’t be used because it’s for linux/windows, we are using ios 6.
The ibm driver is not compatible because we don’t have an actual database name( or port ), only the folder that holds all the schemas(hence the need for those ibm db2 functions).
Digging further I found out that the our db uses different schemas than the ones provided by the yii extensions I found.
A colleague of mine suggested plugging zend components into yii, seeing as the zend framework adapter config files accept the parameters I provide, that is, the host/uid/pwd and options(can’t use the db without selecting that schema ). I’d like to leave this as a last resort if possible.
Any help and suggestions are very much welcome! I’ve been scratching my head over this for several days now.
Thanks!