Apache auto authenticate DB2

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
adamstemper
Forum Newbie
Posts: 1
Joined: Fri Dec 24, 2010 7:56 am

Apache auto authenticate DB2

Post by adamstemper »

Hello,

I've been programming in VB for not quite two years. Java for about one year. And now my company wants to develop their first PHP application, and I seem to be the guy who gets to do all the "new" language projets. We have 9 RPG programmers, and then myself, the object oriented programmer. So when I come accross as a complete novice with my question, I do apologize.

Let me explain my situation, so that my question is very clear :)

We have an (DB2) IBM ISeries AS400, that runs Apache server, which will host our PHP projects. For development, I run windows xp, using zend studio with a local zend apache server on my PC. I want to connect to the DB2 database, and have found the "adodb/adodb.inc.php" class library to be usable.
By using the below statement, I am able to connect to and query the DB2 database:

Code: Select all

//Variables
define("DB_SERVER", "AS400"); 
define("DB_HOST", "192.168.1.2"); 
define("DB_PORT", "");
define("DB_USER", "DB_USER"); 
define("DB_PASS", "TEST_PASS"); 
define("MYLIBRARY", "TESTLIB"); 
define("CONNECTION_STRING", "DRIVER={iSeries Access ODBC Driver};SYSTEM=".DB_HOST.";DATABASE=".DB_SERVER.";PROTOCOL=TCPIP;PORT=".DB_PORT.";");
...
include('../adodb/adodb.inc.php'); 
$db = ADONewConnection('odbc'); 
//if able to connect
if ($db->Connect(CONNECTION_STRING,DB_USER,DB_PASS)){
     //execute sql statement
     $rs = $db->Execute($sql);
     //if contains rows
     if ($rs) {
          //while more rows
          while (!$rs->EOF) {
                 //for each column in row
                 for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++) 	
     	      {echo $rs->fields[$i];}
                 //next row
                 $rs->MoveNext();	
          }	
     }
}
The problem at hand however, is that I am required to figure out how to automatically authenticate the user, instead of passing in the USER and PASS during the connection. I am told by our management (an IBM programmer) that because Apache will host this application, Apache runs on our ISeries, and the application is only accessed within our private network that requires a domain login... we would be able to automatically grab the user credentials, and then their own already-set security rights would determine if the user has access to the requested query / files. (The idea of a login prompt to get these credentials isnt accepted)

I appreciate any help!

Thanks,
Post Reply