Background Information:
- Visual Studio 2010 (.NET Framework 4.0)
- Informix Server 7.31
- Informix ClientSDK 3.50 TC7 (Windows 32-bit) was installed as well.
I have tried multiple ways suggested online to connect to the Informix server, but all of them do not work for me for whatever reason. I have looked at articles such as Connect Informix with ADO.Net and I have used ConnectionStrings.com to generate a connection string.
When I go to Visual Studio I do the following:
- Server Explorer
- Right-click on Data Connections > Add Connection...
- Microsoft ODBC Data Source | .NET Framework Data Provider for ODBC
- Use connection string (copied/pasted using the ConnectionString website).
- Test Connection
RESULT: ERROR [IM002][Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
- Server Explorer
- Right-click on Data Connections > Add Connection...
- Other | .NET Framework Data Provider for ODBC
- Use connection string (copied/pasted using the ConnectionString website).
- Test Connection
RESULT: ERROR [IM002][Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
- Server Explorer
- Right-click on Data Connections > Add Connection...
- Other | .NET Framework Data Provider for OLE DB
- OLE DB Provider: IBM Informix OLE DB Provider
- Data Links...
RESULT: The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)
Beyond that I wasn't sure what to really fill in there...
Oh, and I even tried to use the sample code provided in the first article, substituting in my connection information:
- HOST: The IP of the server
- SERVICENUM: The Port Number
- SERVER: The servers name
- DATABASE: The database I'm working on
- USER: user id
- PASS: password
Sample code I downloaded/altered:
using System;
using IBM.Data.Informix;
namespace IfxAdoPres.Basics {
public class BasicConnection {
const string HOST = "192.168.OBFUSCATED";
const string SERVICENUM = "5000";
const string SERVER = "myServer";
const string DATABASE = "myDatabase";
const string USER = "myUserID";
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;
}
public void CloseConnection() {
conn.Close();
}
}
}
I get an error on the line conn.ConnectionString = ConnectionString; The exception states "Invalid argument" with no InnerException (basically very unhelpful). The callstack is:
- Basics.exe!IfxAdoPres.Basics.BasicConnection.MakeConnection()
- Basics.exe!IfxAdoPres.Basics.Test.Main(string[] args = {string[0]})
- [External Code]
I am stuck and have no idea what to do... :-/