连接字符串的Informix的.NET [英] Connection string for Informix for .NET

查看:504
本文介绍了连接字符串的Informix的.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用的是Informix数据库,并从.NET连接到它成功地使用ODBC。我们正在使用的连接字符串;

We are using an Informix database, and are connecting to it from .NET sucessfully using ODBC. The connection string we are using is;

DRIVER={IBM INFORMIX ODBC RIVER};
UID=username; PWD=password;
DATABASE=our_database;
HOST=devsrv01;
SERVER=devsrv01_tcp;
SERVICE=ids9tcp2;
PROTOCOL=onsoctcp;
CLIENT_LOCALE=en_US.CP1252;
DB_LOCALE=en_US.819;

我们想从ODBC更改,并使用IBM的SDK和库的概述他们的网站上

We want to change from ODBC and use IBM's SDK and libraries as outlined on their site.

我们正在使用的code为;

The code we are using is;

string ConnectionString = "Database=our_database; Server=172.22.0.0:1528; UID=username; Password=password; ";

try
{                               
    IfxConnection conn = new IfxConnection(ConnectionString);
    conn.Open();
}
catch (IfxException ex)
{}

在conn.Open()引发异常;

The conn.Open() throws the exception;

错误[08001] [IBM] SQL30081N已检测到通信错误。通信协议被用于:TCP / IP。通信API正在使用:套接字。 172.22.0.0:检测到错误的位置。通信功能检测到错误的:接收。协议特定的错误code(S):的的,0。 SQLSTATE = 08001

ERROR [08001] [IBM] SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "172.22.0.0". Communication function detecting the error: "recv". Protocol specific error code(s): "", "", "0". SQLSTATE=08001

啊哈!你说。只要在 PROTOCOL = onsoctcp; 但是这使得 IfxConnection(的ConnectionString); 命令抛出的ArgumentException 。如果连接字符串包含任何无效的<场> =<价值> 设置它将引发此异常。如果我把垃圾中的垃圾=;在它抛出相同的ArgumentException这让我觉得它不承认协议(或PRO)字段。

"Ah ha!" you say. Just put in "PROTOCOL=onsoctcp;" But this makes the IfxConnection(ConnectionString); command throw an ArgumentException. If the connection string contains any invalid <field>=<value> setting it throws this exception. If I put in garbage=junk; in it throws the same ArgumentException which makes me think it doesn't recognise the Protocol (or PRO) field.

(仅供参考)172.22.0.0是IP的devsrv01并没有结束0.0。

(FYI) 172.22.0.0 is the IP for devsrv01 and does not end 0.0.

推荐答案

我eventaully发现,答案是包括;

I eventaully found out that the answer was to include;

Persist Security Info=True;Authentication=Server;

不要问我为什么。我只是使得它的工作。

Don't ask me why. I just makes it work.

+1每个人 - 感谢您的帮助

+1 for everyone - thanks for your help.

这篇关于连接字符串的Informix的.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆