We are using an Informix database, and are connecting to it from .NET sucessfully using ODBC. The connection string we are using is;
DRIVER={IBM INFORMIX ODBC RIVER};
UID=username; PWD=password;
DATABASE=our_database;
HOST=devsrv01;
SERVER=devsrv01_tcp;
SERVICE=ids9tcp2;
PROTOCOL=onsoctcp;
CLIENT_LOCALE=en_US.CP1252;
DB_LOCALE=en_US.819;
We want to change from ODBC and use IBM's SDK and libraries as outlined on their site.
The code we are using is;
string ConnectionString = "Database=our_database; Server=172.22.0.0:1528; UID=username; Password=password; ";
try
{
IfxConnection conn = new IfxConnection(ConnectionString);
conn.Open();
}
catch (IfxException ex)
{}
The conn.Open() throws the exception;
ERROR [08001] [IBM] SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "172.22.0.0". Communication function detecting the error: "recv". Protocol specific error code(s): "", "", "0". SQLSTATE=08001
"Ah ha!" you say. Just put in "PROTOCOL=onsoctcp;
" But this makes the IfxConnection(ConnectionString);
command throw an ArgumentException
. If the connection string contains any invalid <field>=<value>
setting it throws this exception. If I put in garbage=junk; in it throws the same ArgumentException which makes me think it doesn't recognise the Protocol (or PRO) field.
(FYI) 172.22.0.0 is the IP for devsrv01 and does not end 0.0.