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

    Întrebare

  • Hello 

    I Have a huge problem here. I have a simple .Net app that is accessing Sql Azure database. Up to yesterday it was working supper fine. But this morning I have the below error. On my Local I can access the database with absolutely no problem. But only after deployment that my code cannot access the database from the app service in azure. Can somebody explain it to me?

    So Tired of azure, next version of my app will be on AWS. I dont know if only me facing those stupid issues.

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

    6 iulie 2018 11:03

Toate mesajele

  • This error looks like the connection string being used is malformed. Are you intending to use ODBC to access Azure SQL Database from .NET? SqlClient would be a better fit.

    Post your connection string (obfuscated if needed). It may have gotten hosed during the deployment.


    Dan Guzman, Data Platform MVP, http://www.dbdelta.com

    6 iulie 2018 11:13
  • but the connnection string is working on my local. How is this possible?

    And the same connection string was working yesterday...

    is there a new change from microsoft??
    6 iulie 2018 11:16
  • here is my connection string 

    Driver={ODBC Driver 13 for SQL Server};Server=tcp:**************,****;Database=************;Uid=********;Pwd=*********;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;

    6 iulie 2018 11:33
  • but the connnection string is working on my local. How is this possible?


    I suspect the actual connection string being used is different. Check the connection string via the portal to verify it is as expected.

    Dan Guzman, Data Platform MVP, http://www.dbdelta.com

    6 iulie 2018 11:35
  • hey Good idea!
    6 iulie 2018 11:38
  • ok I changed it to the exact same connection string I still have the same issue
    6 iulie 2018 11:44
  • So,

    will check if on AWS I will have the same issue...

    6 iulie 2018 12:19
  • Are you using System.Data.Odbc in your .NET app? Why not System.Data.SqlClient to avoid the ODBC driver dependency? 


    Dan Guzman, Data Platform MVP, http://www.dbdelta.com

    6 iulie 2018 13:12
  • If I switch to SqlClient I will have to change all my queries right?

    6 iulie 2018 13:13
  • For parameterized queries, yes. SqlClient uses parameter names instead of ordinal '?' tokens. No other query changes.

    Another benefit of SqlClient instead of ODBC from .NET code performance. The performance difference is significant for large result sets.


    Dan Guzman, Data Platform MVP, http://www.dbdelta.com

    6 iulie 2018 13:21
  • Man listen Cannot change all my queries. I am in production

    I have 100 of queries. This is supposed to work and it did for 2 years. ODBC drivers are installed by default.

    So I need another solution. Thanks for helping any way

    6 iulie 2018 14:20
  • Yes, I understand converting to SqlClient is heavy lift at this point.

    Exactly what Azure App service are you using? I wasn't aware any ODBC drivers are installed by default, except perhaps the legacy SQL Server driver on Windows VMs.


    Dan Guzman, Data Platform MVP, http://www.dbdelta.com

    6 iulie 2018 14:39
  • I just published an azure app service from visual studio 2017.  It worked for 2 years.

    for the connection string I got the odbc connection string from the azure portal. It usually worked

    Now am stuck dont know what to do. And ticket openned on Microsoft they dont even respond. Waiting for an enginer for 3 hours now.

    Serously this is the last time I use Microsoft Azure. This product sucks. From day one. This is just the bottom.

    6 iulie 2018 15:36
  • Do you know how to install odbc driver on an azure app service machine?

    Is it possible? 

    6 iulie 2018 15:49
  • I don't believe it is possible to install ODBC drivers. It looks like the ODBC driver you used was installed for some other component and not intended to be used in .NET app service code.

    Try changing the driver to "Microsoft SQL Server Native Client 11.0". It looks like that's installed as a dependency for SQLCMD on a running app service I have.


    Dan Guzman, Data Platform MVP, http://www.dbdelta.com

    6 iulie 2018 16:28
  • Have you had a chance to see if the SQL Server Native Client ODBC driver works, or have you found another resolution?

    Dan Guzman, Data Platform MVP, http://www.dbdelta.com

    10 iulie 2018 10:41