IBM.Data.Informix.dll 抛出异常 c# 连接 informix
我尝试使用 IBM.Data.Informix (位于 C:\Program Files\IBM\IBM DATA SERVER DRIVER\bin\netf20_32\IBM.Data.Informix.dll 中)连接到 informix 服务器 11.5 。我使用的是 vb2008,当我尝试连接时会抛出错误无效参数
。
问题出在哪里?谢谢
public static IfxConnection MAkeConnInformix()
{
IfxConnection cnn = new IfxConnection();
string error = "";
try
{
string ConnectionString = Database=mydbname;Host=10.8.8.50;Server=mainserver_net;Service=1526; Protocol=onsoctcp;UID=myuser;Password=mypass";
cnn.ConnectionString = ConnectionString;
}
catch (Exception ex)
{
error = ex.Message;
}
return cnn;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果由于区域设置有问题而无法连接,则将属性添加到连接字符串中。我不使用 .net,但在 JDBC 中,带有波兰语言环境信息的 Informix 连接字符串如下所示:
在 http://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/ 那里是一个示例,说明 DB_LOCALE 和其他内容可以添加到 .net connet string/
If you cannot connect because something is wrong with locale then add properties to your connect string. I do not use .net, but in JDBC such Informix connect string with Polish locale info looks like:
In Listing 1 on http://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/ there is example that says that DB_LOCALE and others can be add to .net connet string/
问题在于 Informix 有两个本机驱动程序:SQLI 和 DRDA(或数据服务器驱动程序)。您正在引用 DRDA 驱动程序,但正在使用 SQLI 驱动程序中的连接字符串语法。例如关键字protocol仅存在于SQLI中。驱动程序和示例连接字符串之间的差异如下:开始使用IBM Data Server .NET Provider for Informix
所有关键字列表:IBM 数据服务器驱动程序配置关键字 - 很难使用,因为大多数关键字与 Informix 无关。
The problem is that Informix have two native drivers: SQLI and DRDA (or Data Server Driver). You are referencing DRDA driver but you are using connection string syntax from SQLI driver. For example keyword protocol exist only in SQLI. Differences between drivers and sample connection strings are here: Get started with the IBM Data Server .NET Provider for Informix
List of all keywords: IBM Data Server Driver configuration keywords - difficult to use because most of it is irrelevant in case of Informix.