There's something odd here because if DB2_I5_NAMING_ON is active, then it should only be accepting / as the qualifier. That suggests to me that you haven't succeeded in setting it correctly but I'm darned if I can spot the "deliberate mistake".

This is the way I set options.

$options = array('i5_naming' => DB2_I5_NAMING_ON, 'i5_libl' => 'MYLIB1 MYLIB2' );

The do:

$conn = db2_connect($database, $user, $password, $options);

Alan Seiden has a presentation on using DB2 tat covers a lot of the bits and pieces. Can't get to the latest version on his site right now but there is this version on Zend's site <> might be worth a read to find some hints.

Jon Paris

On Aug 11, 2017, at 5:20 PM, Jason Aleksi <jason.aleski@xxxxxxxxx> wrote:

I was wondering if someone could point me in a direction regarding a
db2_prepare statement. In my connection options, I specify a library list.
However, with or without the library list, I still have to fully qualify
the database name in the query. Otherwise, I get a db2_prepare():
Statement Prepare Failed in error.

$database['options'] = array('i5_libl' => 'CUSLIB',
'i5_naming' => 'DB2_I5_NAMING_ON'

$conn = db2_connect($database['server'],

print 'Connection successful.';

$params = array('123456789', 'MYLASTNAME');
$query = "SELECT count(*) FROM CUSLIB.CUSLOC WHERE locid = ? AND
lastname = ?";
$stmt = db2_prepare($conn, $query);

print 'Connection failed.';

Should I not be able to just use the library list without fully qualifying
the database in the SQL statement?

This is the IBMi Open Source Roundtable (OpenSource) mailing list
To post a message email: OpenSource@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: OpenSource-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.