title: How to check if my ODBC Data Source exist in PHP?
body: <p>I have a simple project and that is to create a function that will check for mysql and odbc connection. I'm already done in creating the function for mysql, here's my sample code:</p>
  
  <pre><code>function check() {
      $serverName = 'localhost';
      $userName = 'root';
      $password = '123';
      $db = 'sample';
  
      $conn = mysql_connect($serverName, $userName, $password);
      mysql_select_db($db, $conn);
  
      $trans = 'SELECT * FROM Labels';
      $trans_result = mysql_query($trans, $conn);
  
      if(!$trans_result) {
          die(mysql_error());
      } else {
          echo "connected";
      }
  }
  </code></pre>
  
  <p>Well this one works for me when checking for the mysql connection. Now, my question is, is it possible to create something like this for checking my odbc data source connection? So that would be like</p>
  
  <pre><code>$conn = odbc_connect("spmuse1","" ,""); # Open connection.
  
  $trans = "SELECT French FROM Labels";
  $trans_result = odbc_exec($conn, $trans);
  
  if(!$trans_result) {
      echo "error?";
  } else {
      echo "connected";
  }
  </code></pre>
  
  <p>You know what I mean? When I use this code, I always have 2 this error</p>
  
  <p><strong>Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect</strong></p>
  
  <p><strong>Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource</strong></p>
  
  <p>Please help! Thanks.</p>