Ferdinand Lucatiere
Ferdinand Lucatiere

Reputation: 77

IBM.Data.Informix.dll throws Exception c# connection informix

I try to connect to informix server 11.5 using using IBM.Data.Informix (located in C:\Program Files\IBM\IBM DATA SERVER DRIVER\bin\netf20_32\IBM.Data.Informix.dll). I'm using vb2008 and when I try to connect throws an error invalid argument.

Where is the problem? Thanks

    public static IfxConnection MAkeConnInformix()
    {
        IfxConnection cnn = new IfxConnection();
        string error = "";
        try
        {
            string ConnectionString = Database=mydbname;Host=10.8.8.50;Server=mainserver_net;Service=1526; Protocol=onsoctcp;UID=myuser;Password=mypass";
            cnn.ConnectionString = ConnectionString;
        }
        catch (Exception ex)
        {
            error = ex.Message;
        }
        return cnn;
    }

Upvotes: 1

Views: 6104

Answers (2)

robsosno
robsosno

Reputation: 328

The problem is that Informix have two native drivers: SQLI and DRDA (or Data Server Driver). You are referencing DRDA driver but you are using connection string syntax from SQLI driver. For example keyword protocol exist only in SQLI. Differences between drivers and sample connection strings are here: Get started with the IBM Data Server .NET Provider for Informix

List of all keywords: IBM Data Server Driver configuration keywords - difficult to use because most of it is irrelevant in case of Informix.

Upvotes: 1

Michał Niklas
Michał Niklas

Reputation: 54302

If you cannot connect because something is wrong with locale then add properties to your connect string. I do not use .net, but in JDBC such Informix connect string with Polish locale info looks like:

jdbc:informix-sqli://127.0.0.1:9088/test_db:informixserver=ol_local;DB_LOCALE=pl_PL.CP1250;CLIENT_LOCALE=pl_PL.CP1250;charSet=CP1250

In Listing 1 on http://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/ there is example that says that DB_LOCALE and others can be add to .net connet string/

Upvotes: 1

Related Questions