连接到使用.NET的Informix连接到、NET、Informix

2023-09-03 04:20:29 作者:月亮一键变蓝

服务器信息 Sun Microsystems公司的SunOS 5.8通用补丁2001年10月 服务器:Informix Dynamic Server的版本7.31.UD3

信息:

链接:http://stackoverflow.com/questions/192477/connecting-to-informix-database-from-net 文章: http://www.ibm.com/developerworks / DB2 /库/ techarticle / DM-0510durity / 在我运行Visual Studio 2010(C#4.0)。 在我不在乎,如果它是ODBC VS OLE DB。 在我卸载所有的客户端软件开发工具包针对Informix。我有现成的IBM的Informix CSDK 3.5准备安装(本文使用在例如2.9,但我找不到任何地方)。 我从本文的示例code。

基本上,我是不成功的,在连接到Informix数据库。因为我已经删除了客户端SDK的迹象。在这一点上,我不知道该怎么做。我不知道如果我使用正确的版本ConnectionDriver与否,或者如果我能以某种方式在VS.NET使用DLL和设置连接内部,但似乎没有任何工作。任何帮助刚开到工作的连接将是巨大的:

样品code (从文章):

 使用系统;
使用IBM.Data.Informix;

命名空间IfxAdo pres.Basics {
    公共类BasicConnection {
        常量字符串HOST =192.168.OBFUSCATED;
        常量字符串SERVICENUM =1525; //端口?
        常量字符串SERVER =serverOBFUSCATED;
        常量字符串DATABASE =dbOBF​​USCATEDy;
        常量字符串USER =名为myusername;
        常量字符串PASSWORD =输入mypassword;

        公共IfxConnection康恩=新IfxConnection();

        公共BasicConnection(){}

        公共无效的makeConnection()
        {
            字符串的ConnectionString =
                主机=+主机+,+
                服务=+ SERVICENUM +;+
                服务器=+服务器+,+
                数据库=+数据库+;+
                用户ID =+用户+,+
                密码=+密码+;
            conn.ConnectionString = ConnectionString的;
            尝试
            {
                conn.Open();
                Console.WriteLine(MADE连接!);
            }
            赶上(IfxException前)
            {
                Console.WriteLine(e.ToString());
            }

            到Console.ReadLine();
        }

        公共无效CloseConnection()
        {
            conn.Close();
        }
    }
}
 

解决方案

时采取了一个新的重新安装...删除了所有旧的驱动程序,并安装一个全新的3.5 CSDK,则使用的演示code从文章并使用Setnet32中配置我的连接。

Server Information Sun Microsystems Inc. SunOS 5.8 Generic Patch October 2001 Server: Informix Dynamic Server Version 7.31.UD3

Net2003连接Unix操作系统下的Informix数据库

Information:

Link: http://stackoverflow.com/questions/192477/connecting-to-informix-database-from-net Article: http://www.ibm.com/developerworks/db2/library/techarticle/dm-0510durity/ I am running Visual Studio 2010 (C# 4.0). I don't care if it is ODBC vs OLE DB. I uninstalled all the client SDKs for Informix. I have readily available the IBM Informix CSDK 3.5 ready to be installed (the article uses 2.9 in its example, but I can't find that anywhere). I have the sample code from the article.

Basically, I was unsuccessful at connecting to the Informix DB. I have since removed all signs of the Client SDK. At this point, I have no idea what to do. I don't know if I'm using the right version ConnectionDriver or not, or if I can somehow use a dll and setup the connection internally in VS.NET, but nothing seems to work. Any help just getting a connection to work would be great:

Sample Code (From the article):

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();
        }
    }
}

解决方案

All it took was a fresh reinstall... removed all the old drivers and installed a fresh new 3.5 CSDK, then used the demo code from the article and used the Setnet32 to configure my connection.