Library list issues

General discussion on Zend Server for IBM System i
Post Reply
longnoz
Posts: 33
Joined: Thu Feb 16, 2012 8:55 pm

Library list issues

Post by longnoz » Fri Apr 13, 2018 10:22 pm

Hello

We typically use db2_connect and pass a set of libraries in the i5_libl paramater. This works perfectly for our db2_exec commands (ie simple SQL)
$db = db2_connect($serial_no,strtoupper($_SERVER['PHP_AUTH_USER']),strtoupper($_SERVER['PHP_AUTH_PW']),array('i5_libl' => 'LIBERTU SFALIBR QS36F', 'i5_naming' => DB2_I5_NAMING_ON));

But when we use the toolkit, we are having trouble understanding how the LIBL is working. We use the following command in what we believe is an attempt to re-use the same connection we have used for db2_exec commands:
$obj = ToolkitService::getInstance($db);

Yet in order to successfully call our service program function by means of a PgmCall command, we are obliged to rebuild our library list using a bunch of calls to CLCommand(addlible...) .
$result = $obj->PgmCall($program, $library , $param, $retParam, array('func'=>'StockAvailable') );

It is at this link that we were led to believe we could re-use the existing DB connection: http://files.zend.com/help/Zend-Server- ... ctions.htm

Thanks

aseiden
Posts: 874
Joined: Thu Apr 09, 2009 5:45 pm

Re: Library list issues

Post by aseiden » Tue May 08, 2018 4:19 pm

Longnoz,

Best way to set up a liblist is via the user profile's job description, but what you did should work also. If you want the toolkit job to use the database connection to run programs in, you'll need to specify stateless mode.

Code: Select all

$obj->setOptions(array('stateless'=>true));
Try it.

Alan Seiden
Seidengroup.com

longnoz
Posts: 33
Joined: Thu Feb 16, 2012 8:55 pm

Re: Library list issues

Post by longnoz » Wed May 09, 2018 2:18 pm

Thanks

We already had $obj->setOptions(array('stateless'=>true));

Upon further investigation, I noted that the program in question was implementing the toolkit in a function. The DB connection was not set as a global variable in the function, so the function was not seeing DB connection.

Actually, it is not entirely true that the function was not seeing the database connection. It was able to connect to the database, it just seems that the LIBL portion of the DB connection was not visible to the function, which seems odd.

In any case, the problem is solved now

Thanks

Post Reply