Jason, try removing quotes from ‘DB2_I5_NAMING_ON’.

DB2_I5_NAMING_ON is a constant, so it shouldn’t use quotes.

Try and let us know.


Alan Seiden
Principal, Seiden Group
The PHP on IBM i Experts

Free PHP tips: http://www.seidengroup.com/tips <http://www.seidengroup.com/tips>

Office: 201-447-2437 Cell: 201-248-4704
http://www.seidengroup.com <http://www.seidengroup.com/> | alan@xxxxxxxxxxxxxxx <mailto:alan@xxxxxxxxxxxxxxx>
http://twitter.com/alanseiden <http://twitter.com/alanseiden>
On Aug 11, 2017, at 2:20 PM, Jason Aleksi <jason.aleski@xxxxxxxxx <mailto: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 <mailto:OpenSource@xxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/opensource <http://lists.midrange.com/mailman/listinfo/opensource>
or email: OpenSource-request@xxxxxxxxxxxx <mailto:OpenSource-request@xxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at http://archive.midrange.com/opensource <http://archive.midrange.com/opensource>.

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 midrange.com 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.