连接到使用.NET的Informix [英] Connecting to Informix using .NET

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

问题描述

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

信息:

  • 链接:<一href="http://stackoverflow.com/questions/192477/connecting-to-informix-database-from-net">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和设置连接内部,但似乎没有任何工作。任何帮助刚开到工作的连接将是巨大的:

<一个href="http://www.ibm.com/developerworks/apps/download/index.jsp?contentid=95047&filename=IfxAdo.zip&method=http&locale="相对=nofollow>样品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

Information:

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.

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

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