c# - 使用 .NET 连接到 Informix

标签 c# .net visual-studio-2010 database-connection informix

服务器信息
Sun Microsystems Inc. SunOS 5.8 通用补丁 2001 年 10 月
服务器:Informix 动态服务器版本 7.31.UD3

信息:

基本上,我无法成功连接到 Informix DB。我已经删除了客户端 SDK 的所有标志。在这一点上,我不知道该怎么办。我不知道我是否使用了正确版本的 ConnectionDriver,或者我是否可以以某种方式使用 dll 并在 VS.NET 内部设置连接,但似乎没有任何效果。获得工作连接的任何帮助都会很棒:

Sample Code (来自文章):

using System;
using IBM.Data.Informix;

namespace IfxAdoPres.Basics {
    public class BasicConnection {
        const string HOST = "192.168.OBFUSCATED";
        const string SERVICENUM = "1525"; //Port?
        const string SERVER = "serverOBFUSCATED";
        const string DATABASE = "dbOBFUSCATEDy";
        const string USER = "myusername";
        const string PASSWORD = "mypassword";

        public IfxConnection conn = new IfxConnection();

        public BasicConnection() {}

        public void MakeConnection()
        {
            string ConnectionString =
                "Host = "   + HOST       + "; " +
                "Service="  + SERVICENUM + "; " +
                "Server="   + SERVER     + "; " +
                "Database=" + DATABASE   + "; " +
                "User Id="  + USER       + "; " +
                "Password=" + PASSWORD   + "; ";
            conn.ConnectionString = ConnectionString;
            try
            {
                conn.Open();
                Console.WriteLine("Made connection!");
            }
            catch (IfxException ex)
            {
                Console.WriteLine(e.ToString());
            }

            Console.ReadLine();
        }

        public void CloseConnection()
        {
            conn.Close();
        }
    }
}

最佳答案

只需要重新安装...删除所有旧驱动程序并安装全新的 3.5 CSDK,然后使用文章中的演示代码并使用 Setnet32 配置我的连接。

关于c# - 使用 .NET 连接到 Informix,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3407093/

相关文章:

c# - 我是否应该始终检查某些东西的返回值是否为空

.net - dapper 缓冲区/缓存的解释

c# - Compact Framework 2.0 上的控制反转

visual-studio-2010 - VS2010 : How to prevent changing a Horizontal Tab Group to a Vertical Tab Group when restarting?

c# - 除了早期的 .NET Framework 版本之外,Visual Studio 能否针对早期的 C# 语法?

c# - 我是否必须在所有项目中引用 Entity Framework 6 dll? (不仅是我的 DAL)

c# - 如何编写面部变形器应用程序?

c# - 如何在 C# .Net 中查找字符串中的重复字符

c# - Visual Studio Indent 做了奇怪的事情

c# - ASP.NET Web API 抛出异常