Connect to Informix using .NET.


Sun Microsystems Inc. Server Information SunOS 5.8 General Patch October 2001
Server: Informix Dynamic Server version 7.31.UD3

information:

Basically, I could not connect to the Informix database. Since then, I have removed all the features of the client SDK. At the moment, I have no idea what to do. I do not know if I am using the correct version of ConnectionDriver or not, or if I can somehow use the DLL and establish a connection inside VS.NET, but nothing works. Any help related to connecting to work would be great:

Code example (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();
        }
    }
}
+3
source share
2 answers

, , ... CSDK 3.5, Setnet32 .

+1
public void MakeConnection() {
    string ConnectionString = "Host=" + HOST + "; " +
     "Service=" + SERVICENUM + "; " +
     "Server=" + SERVER + "; " +
     "Database=" + DATABASE + "; " +
     "User Id=" + USER + "; " +
     "Password=" + PASSWORD + "; ";

    IfxConnection conn = new IfxConnection();
    conn.ConnectionString = ConnectionString;
    try {
        conn.Open();
        Console.WriteLine("Made connection!");
        Console.ReadLine();
    } catch (IfxException ex) {
        Console.WriteLine("Problem with connection attempt: "
                          + ex.Message);
    }
}

: http://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/

0

Source: https://habr.com/ru/post/1758034/


All Articles