0

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?

Andr
  • 88
  • 1
  • 10
  • Static part of the SQL30081N error for each scenario I try: Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS" SQLSTATE=08001 SQLCODE=-30081 – Andr Jun 04 '18 at 07:35
  • SG with SG Desktop Client turned ON - Communication function detecting the error: "recv". Protocol specific error code(s): "*", "*", "0". – Andr Jun 04 '18 at 07:35
  • SG with SG Desktop Client turned OFF - Communication function detecting the error: "connect". Protocol specific error code(s): "111", "*", "*". – Andr Jun 04 '18 at 07:35
  • SG with SG COUD Client - Communication function detecting the error: "recv". Protocol specific error code(s): "*", "*", "0" – Andr Jun 04 '18 at 07:35
  • Are you following "Scenario-2" on page https://www.ibm.com/support/knowledgecenter/en/SS6NHC/com.ibm.swg.im.dashdb.doc/connecting/connect_connecting_php.html – mao Jun 04 '18 at 10:04
  • that worked for DashDB. I could connect to DashDB on cloud. But now I would like to connect to a zOS/DB2 (bluezone) DB... – Andr Jun 04 '18 at 11:11
  • but yes.. I'm using the code that is shown on the link you sent. – Andr Jun 04 '18 at 11:13
  • 2
    The SQLCODE -30081 reason code has . The "0" means remote side terminated the connection (either SG or Z/OS), and "111" means connection-refused. Does the SG allow both unencrypted and encrypted connections? If so, does the symptom change when using unencrypted versus encrypted connections? Did you get the cert for your Z/OS hostname and use it? – mao Jun 04 '18 at 11:19
  • SQLCODE -30081 reason code has - when rc1 = "111" is on that case when I turn down the Secure Gatways Client side... for testing purposes.. to check if the error code changes in case I turn off a part of the SG. – Andr Jun 04 '18 at 11:32
  • No I did not get certification for Z/OS hostanem, and I don't use it... will need to look into this how to get one. – Andr Jun 04 '18 at 11:33
  • Also I did not check for encryption.. thx for these two directions. – Andr Jun 04 '18 at 11:34

1 Answers1

0

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.

Andr
  • 88
  • 1
  • 10