ZF2 Zend \ Paginator \ Adapter \ Db Select in DB2 i Series

I'm creating a Zend APIgility app REST service and have a problem with my fetchAll Mapper function.

I am connecting to an IBM DB2 database running on an i Series (AS / 400) server through DB2 Connect on a windows application server.

My Connection is executed in my local.php as such:

return array(
    'db' => array(
        'driver' => 'IbmDb2',
        'database' => $database,
        'username' => $user,
        'password' => $password,
        'hostname' => $host,
        'port' => $port,
        'driver_options' => array(
            'i5_naming' => DB2_I5_NAMING_ON,
            'i5_lib' => 'LIBWEB',
        ),
    ), 
);

      

The fetchAll () function in my Mapper class:

public function fetchAll()
{
    $select = new Select('WBRESOURCE');
    $paginatorAdapter = new DbSelect($select, $this->adapter);
    $collection = new ResourcesCollection($paginatorAdapter);
    return $collection;
}

      

When I hit DbSelect, ZF2 throws the following DB2 Connect error:

"[IBM][CLI Driver][AS] SQL0204N \"*LIBL.WBRESOURCE\" is an undefined name. SQLSTATE=42704"

      

I'm not sure why its using * LIBL (User Defined Libraries List), since I have defined a library (SCHEMA) to use as LIBWEB in my connect option.

Thanks in advance!

Rob

+3


source to share


1 answer


Try to change this section:

'driver_options' => array(
    'i5_naming' => DB2_I5_NAMING_ON,
    'i5_lib' => 'LIBWEB',

      

Change to ":



'driver_options' => array(
    'i5_naming' => DB2_I5_NAMING_OFF,    <=== change
    'i5_lib' => 'LIBWEB',

      

Using DB2_I5_NAMING_OFF, you should get the SQL naming mode. Using the DB2 i5 naming mode will result in things like using a list of job libraries.

For details on the parameter, see PHP: db2-connect .

+1


source







All Articles