phpdb2ibm-cloudzossecure-gateway

zOS DB2 connection string in PHP - from Bluemix to zOS


I have a sample connection string from DashDB (DB2) on cloud that worked when I connected from Bluemix (A PHP cloud foundry app) to a cloud based DB2.

Now I would like to connect to a zOS DB2 DB using a Secure Gateway. I have the SG already set up and I have SG hostname and port also.

Here is the connection string preparation using the sample from DashDB and adding the Secure Gatway hostname and port number and my pw and my userID for this zOS DB2 database:

        $database = "EU***DB2*";        
        $hostname = "cio-sg-02.integration.ibmcloud.com";  
        $user     = "**myuserID**";   
        $password = "**myPW**";   
        $port     = **portfromSecureGatway**;          
        $ssl_port = **portfromSecureGatway**;          

Here is the connection string build up (also from the DashDB sample..)

$driver  = "DRIVER={IBM DB2 ODBC DRIVER};";
        $dsn     = "DATABASE=$database; " .
                   "HOSTNAME=$hostname;" .
                   "PORT=$port; " .
                   "PROTOCOL=TCPIP; " .
                   "UID=$user;" .
                   "PWD=$password;";
        $ssl_dsn = "DATABASE=$database; " .
                   "HOSTNAME=$hostname;" .
                   "PORT=$ssl_port; " .
                   "PROTOCOL=TCPIP; " .
                   "UID=$user;" .
                   "PWD=$password;" .
                   "SECURITY=SSL;";
        $conn_string = $driver . $dsn;     # Non-SSL
        //$conn_string = $driver . $ssl_dsn; # SSL

Am I using the right driver for zOS/DB2?

and here is the connection command in PHP:

$connection = db2_connect($conn_string,$user,$password);

I opened a ticket for Secure Gateways Support team because I get SQL30081N error message with various setups (based on if I connect using SG Desktop Client - its running, - its not running, I'm using hosted SG Client.. and if I don't use SG and try to connect directly to zOS from my desktop (that case I receive license error as I don't have the zOS license file set up yet.)

Is it possible that the missing license causing the SQL30081N error too?

Support tells that I have an application error. Is it possible that I'm using the wrong connection string?


Solution

  • SQL30081N did not found any suggestion on the web yet.. but I received this error message because of Secure Gatway ACL file content. ... fixed it and it works now.