"Data source name not found and no default driver specified" for creating access connection

13,366

Solution 1

There is an easy way to get the connection string, try it as follow:

  • Create a text file and change it's extension to .udl.
  • Open the new file by double click it and choose to open it with any text editor, notepad for example.
  • In the opened window, choose your provider and your database and click OK.
  • Open this file with notepad as a text and you will find the connectoin string inside it.

See This for more details.

Solution 2

as you can see in the same site you have linked above, the default way to connect to access database is specifying the Microsoft.Jet.OLEDB.4.0 Provider:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;

does this work and if not what kind of errors do you get?

Share:
13,366
olidev
Author by

olidev

Updated on June 21, 2022

Comments

  • olidev
    olidev almost 2 years

    This is my connection to an access database in .NET:

    OdbcConnection conn = new OdbcConnection("Driver={Microsoft Access Driver (*.mdb)};Dbq=" + path + "\\Access.mdb;Uid=;Pwd=;");
    

    And I got this problem:

    base {System.Data.Common.DbException} = {"ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"}
    

    I have tried couple of database connection strings from here: http://www.connectionstrings.com/access but none of them working.

    Any suggestions for this?

    Thanks in advance.