开发者

Informix can't connect via IBM.Data.Informix

开发者 https://www.devze.com 2023-04-07 09:12 出处:网络
I\'m trying to connect to Informix database using sample code from https://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/

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:

Informix can't connect via IBM.Data.Informix

Please help!


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

0

精彩评论

暂无评论...
验证码 换一张
取 消