OleDB or ODBC from Azure Func or Logic App

守給你的承諾、 提交于 2021-01-29 17:47:48

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/57987455/oledb-or-odbc-from-azure-func-or-logic-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!