2 Replies - 1319 Views - Last Post: 03 July 2013 - 10:08 AM Rate Topic: -----

#1 Emwat Oon  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 51
  • Joined: 07-January 12

SqlConnection to OdbcConnection; Data source name not found and no d..

Posted 03 July 2013 - 07:34 AM

Previously, my problem was the connectionstring and all my problems rose from there. I finally got a working connectionstring using a udl file. Tested its connection and success. It works with SqlClient.

Now, I'm using Windows 7 x32, SQL Server Express, on IIS, with C#. The following code works.

	using (SqlConnection con = new SqlConnection(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=personnet;Integrated Security=Yes;"))


But when I try replacing all the Sql to Odbc, I get this error.

Exception Details: System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I do not think it is the connectionstring. I do think my database is compatible with odbc. See
http://www.connectio...s/sqlconnection

http://www.connectio...ovider-for-odbc

I do not think it's anything related to x64 since I'm on a x32 OS. My provider is Sql Server Native Client 11.0. If I do try to add the provider, the keyword Provider is not recognized. I do believe I have the installed ODBC drivers. I installed ODBC Driver 11 for SQL Server just to make sure, but no luck. This is all on localhost, so I don't believe in adding to System DSN.

Is This A Good Question/Topic? 0
  • +

Replies To: SqlConnection to OdbcConnection; Data source name not found and no d..

#2 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 441
  • View blog
  • Posts: 1,488
  • Joined: 28-April 09

Re: SqlConnection to OdbcConnection; Data source name not found and no d..

Posted 03 July 2013 - 09:52 AM

If you're connecting to SQL Server why are you trying to force it to use ODBC instead of the SQL drivers?
Was This Post Helpful? 0
  • +
  • -

#3 Emwat Oon  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 51
  • Joined: 07-January 12

Re: SqlConnection to OdbcConnection; Data source name not found and no d..

Posted 03 July 2013 - 10:08 AM

The SQL server was meant to be a test just to see if I could get a working database. The real server is a db2 database.

In hindsight, I should've made it the same database; though, I'm a bit reluctant dealing with database setups.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1