"ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"

Raki 481 Reputation points

Hello All,
i am trying to connect to sql server database using ODBC connection string. i am fine when i access application with local sql server. but problem is when connecting to another standalone sql server. the error i am getting is "err.Message = "ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified" i have tried installing with both 32/64 bit version of ODBC driver but getting same error. FYI, i was able to do test connection successfully using odbc to that sql server. problem is when trying to access the application from my local machine to that sql server. As you can below is the error i am getting.

<add name="Test" connectionString ="Data Source=JohnTest;Initial Catalog=Department;User ID=123;Password=123;"/>  


SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,297 questions
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,519 questions
0 comments No comments
{count} votes

Accepted answer
  1. Cris Zhan-MSFT 6,601 Reputation points

    Hi @Raki ,

    Try to configure both user DSN and System DSN for this connection in the ODBC data source, and create DSN and test in both 32-bit/64-bit ODBC data source.

    Or also try to directly specify the driver name in connection string.

    1 person found this answer helpful.

6 additional answers

Sort by: Most helpful
  1. AS 211 Reputation points

    I think you need to add the Server paramater to your connection string so for example "server=ServerA;Data Source=JohnTest...."

    "..." is the same as you have and you can use an IP address instead of ServerA if you prefer.

    Are you doing the test connection from the ODBC control panel screen and selecting or specifying the server name?

    0 comments No comments

  2. Raki 481 Reputation points

    Hello As-6265,

    Thanks for your reply. i have tried with server name parameter as well ip address, nothing is working. yes i have done testing with odbc control panel using server name and i was able to connect. what could be the issue?

    Note: i am using sql server authentication to access the sql server.

    <add name="Test" connectionString ="Server=Tower; Database=Colon;User ID=test1;Password=test1;"/>

  3. Erland Sommarskog 99,071 Reputation points MVP

    If you connect by ODBC, you either give a DSN which then has most of the configuation. Or you specify all in the connection string, and you start with the driver. For instance:

    Driver={ODBC Driver 17 for SQL Server}

    But then that depends on exactly which version of the ODBC driver you are using.

    Then again, any particular reason you are using ODBC? The only reason to use ODBC is if you want to target multiple database engines, and not only SQL Server. Else you would use SqlClient and not OdbcClient.

    0 comments No comments

  4. Raki 481 Reputation points

    Hello All,

    now i can access the sql server from my development workstation (windows 10) using below ODBC but having same issue when trying to access from Azure web server which is windows server 2019 datacenter. any idea what could be the issue?

    Update: i just noticed if i run/debug the application with visual studio on the azure web server i can get to the sql server but sitting into iis giving same error.


    0 comments No comments