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

Raki 481 Reputation points
2021-01-12T17:49:24.317+00:00

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;"/>  

55843-image.png

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

Accepted answer
  1. Cris Zhan-MSFT 6,636 Reputation points
    2021-01-13T03:18:16.42+00:00

    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.
    https://www.connectionstrings.com/microsoft-odbc-driver-13-for-sql-server/

    1 person found this answer helpful.

6 additional answers

Sort by: Most helpful
  1. AS 211 Reputation points
    2021-01-12T18:30:44.87+00:00

    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
    2021-01-12T20:27:49.823+00:00

    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 112.7K Reputation points MVP
    2021-01-12T22:45:03.863+00:00

    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
    2021-01-13T20:18:06.533+00:00

    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.

    56343-image.png

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.