title: How do I connect to Informix with .NET?
body: <p>Background Information:</p>
  
  <ul>
  <li>Visual Studio 2010 (.NET Framework 4.0)</li>
  <li>Informix Server 7.31</li>
  <li>Informix ClientSDK 3.50 TC7 (Windows 32-bit) was installed as well.</li>
  </ul>
  
  <p>I have tried multiple ways suggested online to connect to the Informix server, but all of them  do not work for me for whatever reason. I have looked at articles such as <a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/" rel="nofollow noreferrer">Connect Informix with ADO.Net</a> and I have used <a href="http://www.connectionstrings.com/informix" rel="nofollow noreferrer">ConnectionStrings.com</a> to generate a connection string.</p>
  
  <p>When I go to Visual Studio I do the following:</p>
  
  <ol>
  <li>Server Explorer</li>
  <li>Right-click on Data Connections > Add Connection...</li>
  <li>Microsoft ODBC Data Source | .NET Framework Data Provider for ODBC</li>
  <li>Use connection string (copied/pasted using the <a href="http://www.connectionstrings.com/informix" rel="nofollow noreferrer">ConnectionString</a> website).</li>
  <li>Test Connection</li>
  </ol>
  
  <p>RESULT: ERROR [IM002][Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.</p>
  
  <ol>
  <li>Server Explorer</li>
  <li>Right-click on Data Connections > Add Connection...</li>
  <li>Other | .NET Framework Data Provider for ODBC</li>
  <li>Use connection string (copied/pasted using the <a href="http://www.connectionstrings.com/informix" rel="nofollow noreferrer">ConnectionString</a> website).</li>
  <li>Test Connection</li>
  </ol>
  
  <p>RESULT: ERROR [IM002][Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.</p>
  
  <ol>
  <li>Server Explorer</li>
  <li>Right-click on Data Connections > Add Connection...</li>
  <li>Other | .NET Framework Data Provider for OLE DB</li>
  <li>OLE DB Provider: IBM Informix OLE DB Provider</li>
  <li>Data Links...</li>
  </ol>
  
  <p>RESULT: The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)</p>
  
  <p>Beyond that I wasn't sure what to really fill in there...</p>
  
  <p>Oh, and I even tried to use the <a href="http://www.ibm.com/developerworks/apps/download/index.jsp?contentid=95047&amp;filename=IfxAdo.zip&amp;method=http&amp;locale=worldwide" rel="nofollow noreferrer">sample code</a> provided in the <a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/" rel="nofollow noreferrer">first article</a>, substituting in my connection information:</p>
  
  <ul>
  <li>HOST: The IP of the server</li>
  <li>SERVICENUM: The Port Number</li>
  <li>SERVER: The servers name</li>
  <li>DATABASE: The database I'm working on</li>
  <li>USER: user id</li>
  <li>PASS: password</li>
  </ul>
  
  <p>Sample code I downloaded/altered:</p>
  
  <pre><code>using System;
  using IBM.Data.Informix;
  
  namespace IfxAdoPres.Basics {
      public class BasicConnection {
          const string HOST = "192.168.OBFUSCATED";
          const string SERVICENUM = "5000";
          const string SERVER = "myServer";
          const string DATABASE = "myDatabase";
          const string USER = "myUserID";
          const string PASSWORD = "myPassword";
  
          public IfxConnection conn = new IfxConnection();
          public BasicConnection() {}
  
          public void MakeConnection() {
              string ConnectionString = "Host = " + HOST + "; " +
                  "Service=" + SERVICENUM + "; " +
                  "Server=" + SERVER + "; " +
                  "Database=" + DATABASE + "; " +
                  "User Id=" + USER + "; " +
                  "Password=" + PASSWORD + "; ";
  
              conn.ConnectionString = ConnectionString;
          }
  
          public void CloseConnection() {
              conn.Close();
          }
      }
  }
  </code></pre>
  
  <p>I get an error on the line conn.ConnectionString = ConnectionString; The exception states "Invalid argument" with no InnerException (basically very unhelpful). The callstack is:</p>
  
  <ul>
  <li>Basics.exe!IfxAdoPres.Basics.BasicConnection.MakeConnection()</li>
  <li>Basics.exe!IfxAdoPres.Basics.Test.Main(string[] args = {string[0]})</li>
  <li>[External Code]</li>
  </ul>
  
  <p>I am stuck and have no idea what to do... :-/</p>