【发布时间】:2019-09-29 20:49:21
【问题描述】:
我有一个使用 Access 数据库(.mdb 文件)的旧应用程序。基本上,它读取现有的 mdb 文件并填充新数据,这些数据由下游系统使用。我们无法摆脱 mdb 文件,它的功能非常重要,因为它被各种客户端使用。
我们需要将该应用程序迁移到 Azure,并且我们提出了几个 Azure Func 和 Logic App。我们正在寻找实现此功能的可能选项。
作为 poc,当我尝试从本地运行的 AF 访问 mdb 文件时,它在打开连接时失败。
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");
}
}
相同的代码在控制台应用程序上运行良好。传递给连接的 mdb 文件路径是绝对本地路径。当在本地 Af 中不起作用时,我不确定这是否会在 Azure 上起作用。
我目前正在使用“System.Data.Odbc - 4.5.0”,我得到的异常是
“无法加载 DLL 'libodbc.so.2' 或其依赖项之一:找不到指定的模块。(来自 HRESULT 的异常:0x8007007E)”
当我们无法从 AF 或 LogicApp 安装/使用 odbc/oledb 驱动程序时,我们如何访问/操作 mdb 文件。
除了使用虚拟机之外,有没有更好的方法来实现这个功能。
【问题讨论】:
-
您使用什么库或 SDK 来创建 OdbcConnection?项目构建是否正常,只是在函数中抛出异常?可以包含异常文本吗?
-
添加库和异常详情
-
@hungryMind 你解决了吗?我面临类似的情况,我正在寻找如何使用 Azure Functions 来做到这一点
-
是的,我确实使用过 oledb
标签: azure odbc azure-functions azure-logic-apps oledbconnection