Informix 无法通过 IBM.Data.Informix 连接

发布于 2024-12-06 16:29:24 字数 1400 浏览 0 评论 0原文

我正在尝试使用 https: 中的示例代码连接到 Informix 数据库: //www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/ 我正在使用 IBM.Data.Informix.dll 版本 9.7.4.4

我收到错误:“参数不正确”:这是我的代码:

static void Main(string[] args)
{
    MakeConnection("PLPC06", "9090", "TestServer", "clients", "informix", "Password");  
}

public static void MakeConnection(string HOST, string SERVICENUM, string SERVER, string DATABASE, string USER, string PASSWORD)
{
    string ConnectionString = "Host=" + HOST + "; " +
        "Service=" + SERVICENUM + "; " +
        "Server=" + SERVER + "; " +
        "Database=" + DATABASE + "; " +
        "User Id=" + USER + "; " +
        "Password=" + PASSWORD + "; ";
    //Can add other DB parameters here like DELIMIDENT, DB_LOCALE etc
    //Full list in Client SDK's .Net Provider Reference Guide p 3:13
    IfxConnection conn = new IfxConnection();
    conn.ConnectionString = ConnectionString;
    try
    {
        conn.Open();
        Console.WriteLine("Made connection!");
    }
    catch (IfxException ex)
    {
        Console.WriteLine("Problem with connection attempt: " + ex.Message);
    }

    Console.ReadLine();
}

此设置适用于 RazorSQL 来连接:

在此处输入图像描述

请帮忙!

I'm trying to connect to Informix database using sample code from https://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/
I'm using IBM.Data.Informix.dll version 9.7.4.4

I get an error: "argument is not correct": This is my code:

static void Main(string[] args)
{
    MakeConnection("PLPC06", "9090", "TestServer", "clients", "informix", "Password");  
}

public static void MakeConnection(string HOST, string SERVICENUM, string SERVER, string DATABASE, string USER, string PASSWORD)
{
    string ConnectionString = "Host=" + HOST + "; " +
        "Service=" + SERVICENUM + "; " +
        "Server=" + SERVER + "; " +
        "Database=" + DATABASE + "; " +
        "User Id=" + USER + "; " +
        "Password=" + PASSWORD + "; ";
    //Can add other DB parameters here like DELIMIDENT, DB_LOCALE etc
    //Full list in Client SDK's .Net Provider Reference Guide p 3:13
    IfxConnection conn = new IfxConnection();
    conn.ConnectionString = ConnectionString;
    try
    {
        conn.Open();
        Console.WriteLine("Made connection!");
    }
    catch (IfxException ex)
    {
        Console.WriteLine("Problem with connection attempt: " + ex.Message);
    }

    Console.ReadLine();
}

This settings works on RazorSQL to connect:

enter image description here

Please help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏至、离别 2024-12-13 16:29:24

我已经安装了 64 位版本的 IBM 工具。删除所有内容并安装 32 位版本会有所帮助。

I have had installed 64 bit version of IBM tools. Removing everything and installed 32 bit version helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文