× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



HI all -

I am trying to run a PHP script using Zend Server for IBM i in which I
first connect to the IBM i database using a "default" user and password,
then do a few things that determine who the actual user is, and then
connect using that user's user profile and password. I used to do this
using the old "i5_connect" method, but am switching to the
ToolkitService::getInstance method.

Heres the code I'm using

require_once('ToolkitService.php');
$db = 'S1006F9T';
$user = 'WEB@#USER';
$password = 'xxxx';

// Set up connection to use for running programs

try {
$connection = ToolkitService::getInstance($db, $user, $password);
}

catch (Exception $e)
{
echo $e->getMessage(), "\n";
exit();
}

// set stateless mode for easy testing (no 'InternalKey' needed).
$connection->setOptions(array('stateless'=>true));




This works fine. Afterwards, I have some code that figures out based on
user input to a form what the real user and password should be, and i
INCLUDE a script that then contains the following


require_once('ToolkitService.php');

$db = 'S1006F9T';

$user = $_SESSION["User"];
$password = $_SESSION["Password"];


try {
$connection = ToolkitService::getInstance($db, $user, $password);
}

catch (Exception $e)
{echo 'xxx catch section of loginlitweb';
echo $e->getMessage(), "\n";
exit();
}


if (!$connection) { echo "xxx here";
if ($FromSignOn)
$Result = 'Fail';
Else
die ("Could not connect to database " );
}




This does not seem to do anything. Regardless of whether the values in
$user and in $password are valid , the catch section of the code never
seems to execute. I expected that using a bad user/passowrd would trigger
the catch. It looks as if the original connection with my default
user/password remians active no matter what. This method used to work
with -5_connect.

Any ideas what I'm doing wrong?.






Larry Kleinman
Kleinman Associates, Inc.
212-949-6469

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-2024 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.