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

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

问题描述

服务器信息

Sun Microsystems Inc. SunOS 5.8通用补丁2001年10月

服务器:Informix Dynamic Server版本7.31.UD3



信息:





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



示例代码(来自文章):

 使用System; 
使用IBM.Data.Informix;

命名空间IfxAdoPres.Basics {
public class BasicConnection {
const string HOST =192.168.OBFUSCATED;
const string SERVICENUM =1525; //港口?
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配置我的连接。


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天全站免登陆