Connection to db2 via pdo_ibm module with manual configuration of error SQL10007N -5005

I am having difficulty connecting to a remote db2 database using pdo_ibm, I followed the instructions for IBM to configure the pdo_ibm library and linux client, but since my php is not manually configured, but installed via apt-get, I'm not sure if the error may be connected to a configuration mod or anything else.

My scene: Linux debian wheezy ibm client db2 10.5 php 5.4.45 pdo_ibm 1.4

when I try to connect to db2 with the following code:

<?php $usernameMaximo = '@user'; $passwordMaximo = '@password'; $connectionStringMaximo = 'ibm:DRIVER={IBM DB2 ODBC DRIVER}; DATABASE=@databaseName ; HOSTNAME=@xx.xxx.xxx.xx ;PORT=50002;PROTOCOL=TCPIP;'; try { $connection = new PDO($connectionStringMaximo, $usernameMaximo, $passwordMaximo, array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) ); echo "Success"; } catch (Exception $e) { var_dump($e); } 

I get the following error

 object(PDOException)[2] protected 'message' => string 'SQLSTATE= , SQLDriverConnect: -5005 [IBM][CLI Driver] SQL10007N Message "0" could not be retrieved. Reason code: "3". ' (length=123) private 'string' (Exception) => string '' (length=0) protected 'code' => int 0 protected 'file' => string '/apps/html/tests/pdo_db2.php' (length=28) protected 'line' => int 8 private 'trace' (Exception) => array (size=1) 0 => array (size=6) 'file' => string '/apps/html/tests/pdo_db2.php' (length=28) 'line' => int 8 'function' => string '__construct' (length=11) 'class' => string 'PDO' (length=3) 'type' => string '->' (length=2) 'args' => array (size=4) ... private 'previous' (Exception) => null public 'errorInfo' => null 

the network / firewall is already checked, so I can connect through the protein client, did someone have the same problem?

+6
source share
2 answers

Have you tried an alternative way here

The following example shows the DSN PDO_IBM for connecting to a DB2 database cataloged as DB2_MAXIMO in db2cli.ini:

 $db = new PDO("ibm:DSN=DB2_MAXIMO", "", ""); [DB2_MAXIMO] Database=SAMPLE Protocol=TCPIP Port=50002 Hostname=my-db2-machine UID=my-OS-user PWD=my-OS-password 
+3
source

Can you try to set the correct NCIM instance name? default:

  DB2INSTANCE=db2inst1 

To find out if db2inst1 is the correct DB2 instance name, run:

 sudo su db2inst1 db2level 

The answer might be something like this:

 DB21085I Instance "db2inst1" uses "64" bits and DB2 code release "SQL09074" with level identifier "08050107". Informational tokens are "DB2 v9.7.0.4", "s110330", "IP23243", and Fix Pack "4". Product is installed at "/opt/ibm/db2/V9.7". 
+3
source

All Articles