2
votes

I have installed the Informix Client SDK. Then I created a simple .net console application referencing IBM.Data.Informix.dll. When I call IfxConnection.Open() it throws an exception.

ERROR [HY000] [Informix .NET provider][Informix]INFORMIXSERVER does not match either DBSERVERNAME or DBSERVERALIASES. sqlerrm(database)

I have seen this post and I can't seem to find the sqlhosts file in the client machine. Also I can't the environment variables mentioned the post as well.

So my questions are:

  1. How to create the sqlhosts file and where will it be saved? Will this be in the database server or client machine or both?
  2. What are the environment variables needed?
1
What parameters are you passing to the IfxConnection ? You can connect to the Informix instance without a sqlhosts definition on the client side, but you have to provide the Informix server connection info.Luís Marques
This is based on the comments I made below. Host=10.20.30.40; Service=my-service; Server=db_info; Protocol=onsoctcp; Database=mydb; User Id=testuser; Password=******;Jeffrey Lua

1 Answers

1
votes

In a Windows machine the needed configuration is defined by the Setnet32 utility (installed with the Informix Client SDK). You need to set your Informix instance values in that utility for the connection provider to work (Informix .NET Provider).


First define your "Host Information" in the third tab and then click apply (btw I'm in a spanish Windows machine!):

enter image description here

Note: The "Current Host" value should be added to your hosts Windows file (%WINDIR%\System32\drivers\etc\hosts).


Afterwards, define your "Server Information" in the second tab:

  • IBM Informix Server is your Informix instance name (INFORMIXSERVER).
  • Hostname is populated with the hosts defined in the previous step (third tab).
  • Protocolname is the protocol used to communicate with your server (if you're using an unsecured TCP connection, it could be 'olsoctcp' or 'onsoctcp'. Refer to the official documentation to check which value to use).
  • Service name is the name used for your server communication service, which should be added to your services Windows file (%WINDIR%\System32\drivers\etc\services)

Setnet32: Server Information

After these changes you should be able to run your .NET application. Obviously your connection string values should match the information defined in this utility.