从 azure 函数连接到 ODBC 驱动程序
Connecting to ODBC driver from azure function
我目前正在开发连接到 odbc 驱动程序的 azure 函数。我在本地有一个名为 'Dobbe WMS productie' 的设备,我正在使用以下代码连接到它。
using(odbcConnection conn = new OdbcConnection("DSN=Dobbe WMS productie"))
{
conn.Open();
// performs some actions
conn.Close();
}
在本地这工作得很好。现在我将它发布到 azure 并且它没有工作,正如我所料。问题是,我找不到任何东西来解决我的问题。有没有人可以帮我解决这个问题?
编辑:
我的完整错误消息:错误 [IM002] [Microsoft][ODBC 驱动程序管理器] 未找到数据源名称且未指定默认驱动程序。
我在 windows -> System-DSN -> 添加上打开了 ODBC 数据源,然后选择 postgresql ansi 驱动程序。在表格中填写基本信息并点击保存
我也尝试过 Npgsl 并收到以下错误: The remote certificate is invalid according to the validation procedure.
我的连接字符串看起来像这样:Server=address;Port=5432;Database=dbname;User Id=username;Password=password;SslMode=Require
感谢@rene 的帮助,我成功地使用了 NpgSQL。在深入了解服务点经理后,我发现我必须做一件小事。正在将连接字符串修改为如下内容:
Server=address;Port=5432;Database=dbname;User Id=username;Password=password;SslMode=Require;Trust Server Certificate=true
我目前正在开发连接到 odbc 驱动程序的 azure 函数。我在本地有一个名为 'Dobbe WMS productie' 的设备,我正在使用以下代码连接到它。
using(odbcConnection conn = new OdbcConnection("DSN=Dobbe WMS productie"))
{
conn.Open();
// performs some actions
conn.Close();
}
在本地这工作得很好。现在我将它发布到 azure 并且它没有工作,正如我所料。问题是,我找不到任何东西来解决我的问题。有没有人可以帮我解决这个问题?
编辑:
我的完整错误消息:错误 [IM002] [Microsoft][ODBC 驱动程序管理器] 未找到数据源名称且未指定默认驱动程序。
我在 windows -> System-DSN -> 添加上打开了 ODBC 数据源,然后选择 postgresql ansi 驱动程序。在表格中填写基本信息并点击保存
我也尝试过 Npgsl 并收到以下错误: The remote certificate is invalid according to the validation procedure.
我的连接字符串看起来像这样:Server=address;Port=5432;Database=dbname;User Id=username;Password=password;SslMode=Require
感谢@rene 的帮助,我成功地使用了 NpgSQL。在深入了解服务点经理后,我发现我必须做一件小事。正在将连接字符串修改为如下内容:
Server=address;Port=5432;Database=dbname;User Id=username;Password=password;SslMode=Require;Trust Server Certificate=true