title: IIS5 - ODBC - Data source name not found and no default driver specified
body: <p>I’ve got some problem using an ODBC connection with IIS.<br>
  Here is my config :</p>
  
  <ul>
  <li>IIS 5 on Windows XP</li>
  <li>ASP.NET 2.0</li>
  <li>Oracle 9</li>
  <li>VS 2005</li>
  </ul>
  
  <p>When I try too use my web application on IIS, I’ve got the following exception:<br>
  ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified<br>
  BUT, when I use it like a web site in VS2005, I didn’t have any error.</p>
  
  <p>So, I’d try to make a very little app, with the following code:</p>
  
  <pre><code>using System;
  using System.Data;
  using System.Data.Odbc;
  
  public partial class _Default : System.Web.UI.Page 
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          OdbcConnection con = new OdbcConnection();
          con.ConnectionString = "DSN=&lt;MyDSN&gt;;Uid=&lt;LOGIN&gt;;Pwd=&lt;PASSWORD&gt;";
  
          IDbCommand com = new OdbcCommand();
          com.CommandText = "select sysdate from dual;";
          com.CommandType = CommandType.Text;
          com.CommandTimeout = 30;
          com.Connection = con;
  
          try
          {
              con.Open();
              Response.Write(com.ExecuteScalar());
          }
          finally
          {
              if (con.State == ConnectionState.Open)
                  con.Close();
          }
      }
  }
  </code></pre>
  
  <p>It work fine on VS’s web server (ie: <a href="http://localhost:3715/Web/Default.aspx" rel="nofollow noreferrer">http://localhost:3715/Web/Default.aspx</a>), but I’ve got the same exception (IM002) when I use it on IIS (ie: <a href="http://localhost/Tester/default.aspx" rel="nofollow noreferrer">http://localhost/Tester/default.aspx</a>).<br>
  My DSN is declared on the “ODBC Data Source Administrator” and work well when I test the connection…</p>
  
  <p>The ASPNET account is in the same group as my user account (Administrators).<br>
  Full right for ASPNET Account on HKEY_LOCAL_MACHINE\SOFTWARE\ODBC and 
  HKEY_CURRENT_USER\Software\odbc keys.<br>
  I've read this <a href="https://stackoverflow.com/questions/283460/error-microsoftodbc-driver-manager-data-source-name-not-found-and-no-defaul">post</a>, but nothing work...  </p>
  
  <p>I'd look after an answer on stackoverflow (search, related questions, etc.), google...but I didn't found a working solution...<br>
  Is there anyone who have an idea?...<br>
  Where is my mistake?...</p>
  
  <p><strong>UPDATE: 2011/04/06</strong><br>
  What I’ve done so far:  </p>
  
  <ul>
  <li>Tracing for ODBC: on VS’Web server, I got log; but on IIS, none...</li>
  <li>System and User DSN are filled with the same information</li>
  <li>Allow ASPNET, IUSR_XXX, IWAN_XXX, and all users (sic…) accounts full rights to: %ORACLE_HOME%, HKEY_LOCAL_MACHINE\SOFTWARE\ODBC, HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE</li>
  </ul>
  
  <p>Windows, VS and IIS are all for 32 bits (so, there is no c:\windows\syswow64).  </p>
  
  <p>Check PATH value, and put %ORACLE_HOME% first.  </p>
  
  <p>IIS was reset each time I do a modification, my computer reboot twice.  </p>
  
  <p>But, now, I’ve got this message:<br>
  ERROR [IM003] Specified driver could not be loaded due to system error  998 (Oracle dans OraHome92).  </p>
  
  <p>And I finally found... 
  The administrators have install all the drivers in order to be used by the user only...<br>
  I’d create a system env var ORACLE_HOME...<br>
  There was only a user var :s  </p>
  
  <p>Thanks for your help.<br>
  I validate the Garry M. Biggs' answer because of the difference between system/user...</p>