简体   繁体   中英

ZF2 Zend\Paginator\Adapter\DbSelect on DB2 i Series

Im creating a Zend APIgility application REST service and having a problem with my fetchAll Mapper function.

I'm connecting to an IBM DB2 database running on an i Series server (AS/400) via DB2 Connect on a Windows Application Server.

My Connection is is made 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 is:

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

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

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

Im not sure why its using *LIBL (user defined library list), since I defined the library (SCHEMA) to use as LIBWEB in my connection option.

Thanks in advance!

Rob

Try changing 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',

By using DB2_I5_NAMING_OFF, you should get SQL naming mode. The use of DB2 i5 naming mode will result in things like reliance on a job's library list.

See PHP: db2-connect for some info on the parameter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM