title: MySQL OdbcConnection Error System.Data.Odbc.OdbcException
body: <p>I am trying to connect to a MySQL database using an OdbcConnection in C#. I am getting the following error:</p>
  
  <blockquote>
    <p>An unhandled exception of type 'System.Data.Odbc.OdbcException'
    occurred in System.Data.dll</p>
  </blockquote>
  
  <p>Additional information:</p>
  
  <blockquote>
    <p>ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not
    found and no default driver specified</p>
  </blockquote>
  
  <p>What is causing this error?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>String connectionString = "Driver=MySQL ODBC 5.2 UNICODE Driver;Server=myserver.com;Database=mydb;User=myusername;Password=mypassword;Option=3;";
  OdbcConnection myodbcConnection = new OdbcConnection(connectionString);
  OdbcCommand cmd = new OdbcCommand();
  OdbcDataReader reader;
  
  cmd.CommandText = sql;
  cmd.CommandType = CommandType.Text;
  cmd.Connection = myodbcConnection;
  
  myodbcConnection.Open();
  
  reader = cmd.ExecuteReader();
  
  myodbcConnection.Close();
  </code></pre>
  
  <p>I have also tried the following as connection strings:</p>
  
  <pre><code>"Provider=MSDASQL;Driver={MySQL ODBC 5.2 UNICODE Driver};Server=tcr.cjcresources.com;Database=tcr;User=ahardin;Password=go2sql!;Option=3;";
  
  "Driver={MySQL ODBC 5.2 UNICODE Driver};Server=tcr.cjcresources.com;Database=tcr;User=ahardin;Password=go2sql!;Option=3;";
  
  "DSN={MySQL ODBC 5.2 UNICODE Driver};Server=tcr.cjcresources.com;Database=tcr;User=ahardin;Password=go2sql!;Option=3;";
  </code></pre>
  
  <p>and many more the like.</p>
  
  <p>My setting for Control Panel->Administrative Tools->Data Sources (ODBC)</p>
  
  <p>User DSN has: <code>MySQL ODBC 5.2 UNICODE Drive &amp; MySQL ODBC 5.2 ANSI Drive</code></p>
  
  <p>System DSN has: <code>MySQL ODBC 5.2 UNICODE Drive &amp; MySQL ODBC 5.2 ANSI Drive</code></p>
  
  <p>File DSN has: <code>MySQL ODBC 5.2 UNICODE Drive &amp; MySQL ODBC 5.2 ANSI Drive in a ODBC folder</code></p>
  
  <p>I also have MySQL Workbench that is able to connect to the remote Database</p>
  
  <p>Any help would be greatly appreciated </p>