views:

80

answers:

2

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();
        }
    }
}
A: 
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);
    }
}

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

Frank Computer
That's identical to the code he already had (barring the exception text)
Rup
A: 

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.

myermian