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



I appreciate very much all of your responses to this thread.

I will share all of your comments with our PHP web administrator.
I also received a recommendation from the IBM DB2 support team.
(our APACHE server uses db2 connect to communicate with our IBM i
server)

++++++++++++++++
http://php.net/manual/en/function.db2-connect.php
Read all the examples on this page:

Example #5 Using trusted context. The following example shows how to
enable trusted context, switch users, and get the current user ID.
<?php

$database = "SAMPLE";
$hostname = "localhost";
$port = 50000;
$authID = "db2inst1";
$auth_pass = "ibmdb2";

$tc_user = "tcuser";
$tc_pass = "tcpassword";

$dsn = "DATABASE=$database;HOSTNAME=$hostname;PORT=$port;
PROTOCOL=TCPIP;UID=$authID;PWD=$auth_pass;";
$options = array ("trustedcontext" => DB2_TRUSTED_CONTEXT_ENABLE);

$tc_conn = db2_connect($dsn, "", "", $options);
if($tc_conn) {
echo "Explicit trusted connection succeeded.\n";

if(db2_get_option($tc_conn, "trustedcontext")) {
$userBefore = db2_get_option($tc_conn, "trusted_user");

//Do some work as user 1.

//Switching to trusted user.
$parameters = array("trusted_user" => $tc_user,
"trusted_password" => $tcuser_pass);
$res = db2_set_option ($tc_conn, $parameters, 1);

$userAfter = db2_get_option($tc_conn, "trusted_user");
//Do more work as trusted user.

if($userBefore != $userAfter) {
echo "User has been switched." . "\n";
}
}

db2_close($tc_conn);
}
else {
echo "Explicit trusted connection failed.\n";
}
?>
The above example will output:
Explicit trusted connection succeeded.
User has been switched.
+++++++++++++++++++++++++++++
Another example:
pass UserID and Password in the db2_connect API in PHP.

Syntax of the db2_connect php API:

resource db2_connect ( string $database , string $username , string
$password [, array $options ] )

In your PHP application you can request the user to enter their userID
and password.
UserID and password values can be used to make a
connection to the database on IBM i server.

Individual connection userIDs could be specified in the connection
string in PHP application.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.