Reputation: 18465
I have been looking online for days trying to solve my problems and I cannot find anything which hints as to why I get this issue.
The exception is: System.ArgumentException: Invalid argument
I am using IBM.Data.Informix.dll version 9.0.0.2, the connection string has been through many permutations, but based on most examples from IBM and online this is what I have:
Database=testdb; Host=10.0.0.123; Server=test; Service=3013; User Id=testuser; Password=test123; Protocol=onsoctcp;
I have tried setting Service to the name of the service, I have removed it, even tried setting server to the IP rather than the Host. Whatever I do it just keeps coming up with a useless exception which doesn't help at all in debugging.
I am using the IfxConnection class when instanciating:
using System.Data;
using IBM.Data.Informix;
namespace InformixTest
{
public class InformixConnectionFactory : IConnectionFactory<IDbConnection>
{
private string connectionString;
public InformixConnectionFactory(string connectionString)
{
this.connectionString = connectionString;
}
public IDbConnection GetConnection()
{
return new IfxConnection(connectionString);
}
}
}
Every time it steps into the new IfxConnection(connectionString) the exception is thrown, the connection string is injected via the web.config ConnectionStrings section. I am also targeting .net 4 incase this is a problem.
I was using the v9.5fp4_nt32_dsdriver_EN.exe installer to get the driver installed, I did read somewhere once that someone had a similar issue, so they installed the Informix Client SDK, which fixed their issue. I have also done the same but no such luck.
I am using the following sites as a reference for how my connection string should look:
http://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/ http://stackoverflow.com/questions/611345/connection-string-for-informix-for-net
Any help would be great!
Upvotes: 2
Views: 4167
Reputation: 3347
your connection string works on my machine. I had a lot of problem with IfxConnection because I also installed driver first. Then I unistalled drivers and client sdk, restart windows and installed client sdk again. Just in case I restarted windows again. That did it for me.
Also, I think you should switch (if possible) to IBM Data Server .NET Provider for Informix because old informix driver won't be enhanced any more. Look here for comparison:
http://www.ibm.com/developerworks/data/library/techarticle/dm-1007dsnetids/index.html
You will find that "Informix server support" and "Support for .NET framework 3.0, 3.5" features are quite important and old driver doesn't support it. Also, article doesn't mention that old driver doesn't support database metadata retrieval.
Upvotes: 1