PHP ibm_db2 extension - i5_sys_naming on when connecting to DB2 iSeries from Linux *NO SUPPORT*

450 Views Asked by At

We are currently switching our applications to run on a Linux box and connect to the IBMi via DB2 Connect.

So far we've installed db2 connect, have been successful in setting up the 'dummy' database on linux, creating the connection and running SQLs from Linux into the IBMi (both via the command line and from our Zend Applications) - but only when we define the libraries for files in our SQLs.

We are currently running Zend Server 7, Ibm db2 V1.9.7, and DB2 Connect 10.5 on our linux box, along with php version 5.5.

It has been noted that with the new version of Db2 connect 10.5 and ibm_db2 1.9.7 there is support for system naming on LUW. http://yips.idevcloud.com/wiki/index.php/PHP/DB2Connection see the first line.

We have not been successful however in getting the DB2_I5_NAMING_ON to work on our Linux box so that we can avoid specifying the libraries.

Here is an example of an what we are attempting to run from Zend.

$driverOptions = array('i5_libl' => 'library1 library2','i5_naming' => DB2_I5_NAMING_ON, 'i5_lib'=>'library1');

$config = array(
   'adapter' => 'Db2',
   'params' => array(
   'username' => $user,
   'password' => $password,
   'dbname'   => $database,
   'driver_options'=> $driverOptions
   )
);

$config = new Zend_Config($config);
$db = Zend_Db::factory($config);

$select = $db->select()->from("FILENAMEHERE");
$result = $select->query();

However we continue to receive this message

Message: [IBM][CLI Driver][AS] SQL0204N "USERSNAMEHERE.FILENAMEHERE" is an undefined name. SQLSTATE=42704 SQLCODE=-204

It has added the users name in for the library and will not use the specified library list (the '.' in between suggesting it is still using sql naming instead of system).

We have also included ibm_db2.i5_sys_naming=1 in our ibm_db2.ini file.

Does anyone know of any other configuration changes that would need to take place in order for system naming to work or know or any reason why we could be having such problems?

Any help would be greatly appreciated.

2

There are 2 best solutions below

1
WarrenT On

I'm familiar with DB2 on IBM i, but not PHP.

I would try removing the

'i5_lib'=>'library1'

That may be setting your CURRENT SCHEMA, which would activate SQL naming mode, rather than system naming.

Once connected, if you are trying to define a default library for objects to be created in, then consider using the CHGCURLIB CL command. This will put that library in front of the user portion of your library list.

CALL QCMDEXC ('CHGCURLIB somelib');
0
KellyAnne On

This problem was due to the fact that the IBMi machine we were connecting to was working with os 6.1. IBMi V7R1 have been enhanced to provide naming mode control. We are currently working to access a box running V7.1 which should solve our issues.