I'm using IIS on a windows server. I'm having issues trying to connect
to DB2 via PHP.



I can connect to DB2 on the command line on the server.

> db2cmd db2 "connect to emr1u1 user etldbu using xxxx"

  Database Connection Information

Database server        = DB2/AIX64 9.1.3
SQL authorization ID   = ETLDBU
Local database alias   = EMR1U1



When I connect to the same DB in PHP as cataloged or uncataloged, I get
this:

Connection to database failed.
SQLSTATE: 
Message: 




Below are my PHPINFO settings and the cataloged and uncataloged PHP
scripts.



***************
*** PHPINFO ***
***************

*** ibm_db2***

IBM DB2, Cloudscape and Apache Derby support = enabled
Module release = 1.6.3
Module revision = 1.71
Binary data mode (ibm_db2.binmode) = DB2_BINARY  


*** Environment ***

CLASSPATH = .;
C:\PROGRA~1\IBM\SQLLIB\java\db2java.zip;
C:\PROGRA~1\IBM\SQLLIB\java\db2jcc.jar;
C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cu.jar;
C:\PROGRA~1\IBM\SQLLIB\bin;
C:\PROGRA~1\IBM\SQLLIB\java\common.jar  

DB2INSTANCE = DB2
DB2TEMPDIR = C:\PROGRA~1\IBM\SQLLIB\  

Path = F:\PHP\;F:\cygwin\bin;C:\Program Files\EMC\PowerPath\;
C:\Program Files\Windows Resource Kits\Tools\;C:\Program Files\Support
Tools\;
C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\PROGRA~1\IBM\SQLLIB
\BIN;
C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;
C:\Program Files\PGP Corporation\PGP Command Line\;F:\AbInitio\bin  


*****************
*** CATALOGED ***
*****************

<?php

$database = 'emr1u1';
$user = 'etldbu';
$password = 'xxxx';

print 'Timestamp: '. date('H:i:s, F j, Y') ."<p>";

$conn = db2_connect($database, $user, $password);

if ($conn) {
   echo "Connection succeeded.";
   db2_close($conn);
}
else {
   echo "Connection failed.<p>";
   echo 'SQLSTATE: ' . db2_conn_error() . '<br />';
   echo 'Message: ' . db2_conn_errormsg(). '<br />';
}
?>


*******************
*** UNCATALOGED ***
*******************

<?php

$database = 'emr1u1';
$user = 'etldbu';
$password = 'xxxx';
$hostname = 'imdsdev01';
$port = 42016;

print 'Timestamp: '. date('H:i:s, F j, Y') ."<p>";

$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;" .
 
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";
$conn = db2_connect($conn_string, '', '');

if ($conn) {
   echo "Connection succeeded.";
   db2_close($conn);
}
else {
   echo "Connection failed.<p>";
   echo 'SQLSTATE: ' . db2_conn_error() . '<br />';
   echo 'Message: ' . db2_conn_errormsg(). '<br />';
}
?>


Blue Cross Blue Shield of Florida, Inc., and its subsidiary and affiliate 
companies are not responsible for errors or omissions in this e-mail message. 
Any personal comments made in this e-mail do not reflect the views of Blue 
Cross Blue Shield of Florida, Inc.  The information contained in this document 
may be confidential and intended solely for the use of the individual or entity 
to whom it is addressed.  This document may contain material that is privileged 
or protected from disclosure under applicable law.  If you are not the intended 
recipient or the individual responsible for delivering to the intended 
recipient, please (1) be advised that any use, dissemination, forwarding, or 
copying of this document IS STRICTLY PROHIBITED; and (2) notify sender 
immediately by telephone and destroy the document. THANK YOU.

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to