OleDB or ODBC from Azure Func or Logic App

0

I have a legacy application which uses Access database (.mdb file). Basically it reads an existing mdb file and fill with new data, which is consumed by downstream systems. We cannot get rid of mdb file and the functionality is very important as it is consumed by various clients.

We need to migrate that application to Azure and we are proposing several Azure Func and Logic App. We are looking at possible option to achieve this feature.

As a poc when I try accessing mdb file from AF running on local, it fails at while open the connection.

string connString = $"Driver={{Microsoft Access Driver (*.mdb, *.accdb)}};Dbq={dbFileName};";
        using (OdbcConnection connection = new OdbcConnection(connString))
        {
            try
            {
                connection.Open();
                OdbcDataReader reader = null;
                OdbcCommand command = new OdbcCommand("SELECT * from Table1", connection);
                reader = command.ExecuteReader();
                while (reader.Read())
                {
                    return (ActionResult)new OkObjectResult($"Found {reader["Field1"]}");
                }
            }catch(Exception ex)
            {
                log.LogError(ex, "something wrong");
            }
        }

The same code works fine on console app. The mdb file path passed to connection is absolute local path. I am not sure this will work on Azure when the same is not working in local Af.

I am currently using "System.Data.Odbc - 4.5.0" and exception I am getting is

"Unable to load DLL 'libodbc.so.2' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

How can we access / manipulate the mdb file when we cannot install / use odbc / oledb driver from AF or LogicApp.

Is there a good way to implement this feature other than using VM.

azure
odbc
azure-functions
azure-logic-apps
oledbconnection
asked on Stack Overflow Sep 18, 2019 by hungryMind • edited Sep 18, 2019 by hungryMind

1 Answer

0

We do not install the Microsoft.Ace.we.12.0' driver. The Microsoft.Ace drivers are not supported in server side environments and there will be no plans to add these to the Azure Web Sites/Azure Function nor is it possible for you to add these.

This leaves the option of using the Jet Drivers which are installed, however these are only available in 32 bit versions so you will have to configure your site to run in 32 bit versions.

The Microsoft OLE DB Provider for Jet and the Microsoft Access ODBC driver are available in 32-bit versions only:    http://support.microsoft.com/kb/957570/en-us

answered on Stack Overflow Sep 29, 2019 by DixitArora-MSFT

User contributions licensed under CC BY-SA 3.0