Hi all
I have a x32 bit application on a windows10 x64 machine.
The application was working fine untill I change the connection string from OLEDB to ODBC with a DSN.
Since my application x32 bit I created a x32 bit DSN to an ACCESS db wich also is a x32 (Office 365).
When I run the application I receive the error, cannot open database (Unknown) it may not be a database that your application recognizes.
I can oppen the Database from Access fine no pronblem, I also recreated the 32bit DSN dultiple times and the problem still precistes.

Dani AI

Generated

The message "Cannot open database (Unknown)" after switching to ODBC usually means the Access ODBC driver is missing or the DSN/driver bitness does not match your 32-bit app. On 64-bit Windows, make sure you create and test the DSN with the 32-bit ODBC Administrator in %WINDIR%\SysWOW64\odbcad32.exe (the one in System32 is 64-bit). Also confirm the DSN uses the "Microsoft Access Driver (.mdb, .accdb)" and points at the correct .accdb/.mdb path. See Microsoft’s note about using the 32-bit ODBC tool on 64-bit machines. ODBC Data Source Administrator (32-bit).

Building on ’s suggestion to go DSN-less, try a direct connection to remove DSN variables. Replace the file path as needed.

Dim cs = "Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\Data\AUS.accdb;Uid=Admin;Pwd=;"
Using dbcon As New Odbc.OdbcConnection(cs),
      cmd As New Odbc.OdbcCommand("SELECT * FROM Fees", dbcon)
    dbcon.Open()
    Using dr = cmd.ExecuteReader()
        Dim dt As New DataTable()
        dt.Load(dr)
    End Using
End Using

What installing the "2016 redistribute" did (as noted) was add the ACE components, including the Access ODBC driver. For a 32-bit app, install the x86 package (accessdatabaseengine.exe). Microsoft’s download page also shows the correct ODBC connection string format and cautions that this redistributable is not intended for service/server-side scenarios. Microsoft Access Database Engine 2016 Redistributable.

Small correction to : on 64-bit Windows the 32-bit ODBC admin lives under SysWOW64, while System32 hosts the 64-bit one. Details here.

Recommended Answers

All 5 Replies

Sorry missed the code

        Dim dbcon As OdbcConnection
        Dim cmd As OdbcCommand
        Dim dr As OdbcDataReader
        Dim SelectString As String
        dt = New DataTable
        cmd = New OdbcCommand
        SelectString = "Select * FROM Fees"
        Try
            dbcon = New OdbcConnection("DSN=AUS")
            dbcon.Open()
            With cmd
                .CommandType = CommandType.Text
                .CommandText = SelectString
                .Connection = dbcon
                dr = .ExecuteReader
                dt.Load(dr)
            End With

My advice is to go DSN-less to see what this connection requires. There are so many prior discussions about DSN connection failures that I can't guess which is the cause here. Maybe no password?

One other thing, if you really want ODBC then I believe you MUST use the ODBC application found at C:\Windows\System32\odbcad32.exe in older versions of Windows 10 or under Control Panel ODBC Data Sources (32 bit) These are the 32 bit ODBC application on a 64bit Windows 10 machine. The ODBC Application you find as default is typlically 64 bit which won't work with 32 bit apps and of course you can't have two with the same name so I would delete the 64 bit ODBC and create with 32 bit version.

Thank you all for your assistance.
I solved it by installing the 2016 redistribute.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.