title: php pdo connected to DB2 different CODEPAGE
body: <p>I'm connecting to DB2 DB </p>
  
  <pre><code>$sql = 'CALL procedures.name(1,1,'text',1,1,'2017-08-30','2017-08-31',?,?)';
      try {
          $con = new PDO("idb:all_the_connections_stuu",'user','pass',
             [
                PDO::ATTR_PERSISTENT =&gt; FALSE,
                PDO::ATTR_ERRMODE =&gt; PDO:ERRMODE_EXCEPTION,
                PDO::ATTR_CURSOR =&gt; PDO::CURSOR_SCROLL,
                PDO::ATTR_AUTOCOMMIT =&gt; 0
             ]
          );
          $stmt = $con-&gt;prepare($sql);
          $stmt-&gt;bindParam(1, $errorNumber, PDO::PARAM_INT);    //also trying without PDO::params  
          $stmt-&gt;bindParam(2, $errorCode, PDO::PARAM_STR, 800); //and with |PDO::PARAM_INPUT_OUTPUT
          $stmt-&gt;execute();        //return *TRUE*
          var_dump($errorNumber);  //return NULL
          var_dump($errorCode);    //return NULL
          var_dump($stmt-&gt;fetchAll(PDO::FETCH_ASSOC)); //returns Error
          $stmt-&gt;closeCursor();
          $stmt = null;
      } catch (PDOException $e) {
          echo ($e-&gt;getMessage());
      }
  </code></pre>
  
  <p>and got this error:</p>
  
  <pre><code>Fatal error:  Uncaught PDOException: SQLSTATE[57017]: &lt;&lt;Unknown error&gt;&gt;: -332 
  [IBM][CLI Driver][DB2] SQL0332N  
  Character conversion from the source code page "" to the target code page "" is not supported.  
  SQLSTATE=57017
       (SQLFetchScroll[-332] at /home/user/shared/PDO_IBM-1.3.4/ibm_statement.c:1306) in /var/www/html/server/testsIBM/index.php:80
      Stack trace:
      #0 /var/www/html/server/testsIBM/index.php(80): PDOStatement-&gt;fetchAll(7, 0)
      #1 {main}
        thrown in /var/www/html/server/testsIBM/index.php on line 80
  </code></pre>
  
  <p>If I connect with db2_connect </p>
  
  <pre><code>$con = db2_connect("DATABASE=DB2D;HOSTNAME=10.243.13.65;PORT=5000;PROTOCOL=TCPIP;USERNAME=asdf23;PASSWORD=asdfasf1","", "")
  </code></pre>
  
  <p>and output <code>db2_client_info($con)</code> and <code>db2_server_info($con)</code> I see that <em>CONN_CODEPAGE</em> from client = 819 and <em>DB_CODEPAGE</em> from server = 1208.</p>
  
  <p>How can I set <em>CONN_CODEPAGE</em> in my client? I already set LANG in CentOs locale, but still got error of character conversion.</p>
  
  <p>______upd:</p>
  
  <p>Current $LANG = en_US.utf8 (also in <em>locale -a</em> I have en_US, en_US.iso88591, en_US.iso885915, en_US.utf8)</p>
  
  <p>No matter what $LANG is set output from <em>db2_client_info($con)</em> still the same:</p>
  
  <pre><code> ["APPL_CODEPAGE"]=&gt;
    int(819)
    ["CONN_CODEPAGE"]=&gt;
    int(819)
  </code></pre>
  
  <p>And same error about <strong>Character conversion from the source code page</strong></p>
  
  <p>I'm using PHP+Apache. Apache httpd.conf <strong>defaultCharset</strong> setting different locales didnt't change anything. </p>
  
  <p>In php code <strong>setlocale</strong> don't changing anything either.</p>
  
  <p>I think this setting store somewhere else, and <strong>ibm_db2</strong> or <strong>pdo_ibm</strong> drivers use it. =|</p>
  
  <p>____upd2</p>
  
  <p>The only way I found out - change DB2CODEPAGE from installed db2 client. But I don't have installed client. I'm using inly libraries.</p>
  
  <p>Now i installed v11.1.2fp2_linuxx64_client.tar.gz (1.03 GB). But i can't laucn db2 client. Think I need another new question =\</p>
  
  <p>____upd3</p>
  
  <p>After all manipulations with CentOs, apache locales - I still get -322 exception. No matter what I changed - <em>db2_client_info($con)</em> still shows me 819 CodePage. And all work nice, until <code>fetch()/fetchAll()</code></p>
  
  <p>CentOs 7.3, PHP 7.1.8 with PDO_IBM 1.3.4-patched, and ibm_db2. <strong>BUT</strong> I make this modules from PECL sources (cause server doesn't have internet connection).</p>
  
  <p>And I also don't have any DB2 products installed on mine application server (thats why I decide that CodePage getting from CentOs locale). It seems from your test, that <code>DB2 data server client</code> is required?</p>