title: Unable to connect to informix database through php
body: <p>This is what I have done so far............</p>
  
  <p>In order to connect my website to an informix database, I installed Informix client SDK and entered server and host information through Setnet32 and the connection was working when tested through ConnectTest Demo .</p>
  
  <p>Then through ODBC Data Source Administrator in windows I created User DSN and System DSN and tested the connection too.</p>
  
  <p>Now I have created a connection string that goes like this:</p>
  
  <pre><code>$dbh = new PDO("odbc:Driver={IBM INFORMIX ODBC DRIVER};HOSTNAME=172.56.100.12;PORT=8056;DATABASE=eadmin;PROTOCOL=onsoctcp; UID=prsnl;PWD=prsnl;");
  </code></pre>
  
  <p>In this case on trying to login ,the error I get is as follows:</p>
  
  <blockquote>
    <p><code>PDOException: SQLSTATE[HY000] SQLDriverConnect: -11060 [Informix][Informix ODBC Driver]General error.</code></p>
  </blockquote>
  
  <p>I tried another connection string that goes like this :</p>
  
  <blockquote>
    <p><code>$dbh = new PDO("Dsn=bnm_info;Driver={IBM INFORMIX ODBC DRIVER};HOSTNAME=172.56.100.12;PORT=8056;DATABASE=eadmin;PROTOCOL=onsoctcp; UID=prsnl;PWD=prsnl;");</code></p>
  </blockquote>
  
  <p>In this case the error I get is as follows:</p>
  
  <pre><code>PDOException: invalid data source name 
  </code></pre>
  
  <p>To make things more clear,the code for accessing database is as follows:</p>
  
  <pre><code>$query = "select decrypt_char(passwd,'" . $_POST['passwd'] . "') from edak_users where userid='" . $_SESSION['username'] . "'";
  
  $tt = $dbh-&gt;query($query);
  
  $rs=$tt-&gt;fetch(PDO::FETCH_NUM);
  </code></pre>
  
  <p>Please suggest a solution to get me through as this issue is driving me nuts.</p>
  
  <p>Any help is highly welcome.
  Thanking in anticipation</p>