Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
14 replies Latest Post - ‏2011-12-20T18:57:54Z by LudmillaB
SystemAdmin
SystemAdmin
1143 Posts
ACCEPTED ANSWER

Pinned topic Issues with .NET for Informix

‏2011-08-11T17:43:42Z |
I am trying to write an application in C# that will connect to multiple Informix DBs. So far I have been extremely disappointed with the .NET lib provided by IBM.
I have tried several release and I am currently cursing 3.70FC3

For one this driver should be self contained, so I can distribute this without the entire iConnect software.

Second issue is I can't establish a simple connection without it blowing up.

here is the simple example (obviously I have removed my server INFO, so no that isn't the issue).
IfxConnection con = new IfxConnection();
string ConnectionString = "Host=<HOST>; " +
"Service=<SERVICE>; " +
"Server=<SERVER>; " +
"Database=<DB>; " +
"User Id=<USER>; " +
"Password=<PASS>; ";
con.ConnectionString = ConnectionString;
con.Open();

IfxCommand command = new IfxCommand("select * from synonyms", con);

IfxDataReader reader = command.ExecuteReader();
while (reader.Read())
{
string value = reader.GetString(reader.GetOrdinal("value"));
string item_type = reader.GetString(reader.GetOrdinal("item_type"));
string item_name = reader.GetString(reader.GetOrdinal("item_name"));
rtbResults.Text += string.Format("item_type={0} item_name={1} value={2}\r\n",
item_type, item_name, value);
}
reader.Close();
con.Close();

This code, as simple as it is, blows up on the
IfxDataReader reader = command.ExecuteReader();
statement with a the following exception
***********************************************************************************
at IBM.Data.Informix.TypeMap.IfxNameToIfxType(String name, Int32 precision)
at IBM.Data.Informix.IfxDataReader.GetIfxType(Int32 i)
at IBM.Data.Informix.IfxDataReader.BuildMetaDataInfo()
at IBM.Data.Informix.IfxDataReader.IfxRowSet.InitiateRowWiseBinding()
at IBM.Data.Informix.IfxDataReader.IfxRowSet..ctor(IfxDataReader dataReader)
at IBM.Data.Informix.IfxDataReader.FirstResult()
at IBM.Data.Informix.IfxCommand.ExecuteReaderObject(CommandBehavior behavior, String method)
at IBM.Data.Informix.IfxCommand.ExecuteReader(CommandBehavior behavior)
at IBM.Data.Informix.IfxCommand.ExecuteReader()
at InformixConnectTest.Form1.button1_Click(Object sender, EventArgs e) in C:\source\csharp\Tests\InformixConnectTest\Form1.cs:line 38
************************************************************************************

This is an error in the driver not my code. This was released in Apr 2011 and I have found posts back to 2006 with this issue. Why hasn't this been resolved yet? This driver is useless at this point.

I have tried the hoops of the setnet32 and registry entries, to no avail. None of which I feel I should have to do to connect to a database. I have used several .NET libs for different libraries in the past and so far this one is by far the worst.

Someone please help if you can, as you can tell I am extremely frustrated at this point.
Updated on 2011-12-20T18:57:54Z at 2011-12-20T18:57:54Z by LudmillaB
  • SystemAdmin
    SystemAdmin
    1143 Posts
    ACCEPTED ANSWER

    Re: Issues with .NET for Informix

    ‏2011-08-11T19:13:08Z  in response to SystemAdmin
    Hi,

    unfortunately there is a defect in the 3.70.FCx .Net driver. It was fixed yesterday.
    You can open a PMR and request a special build.
    If this is not possible you can try 3.50.FC8. It does not show this problem.

    I am sorry for the inconvinience.

    Regards,
    Marion
    • SystemAdmin
      SystemAdmin
      1143 Posts
      ACCEPTED ANSWER

      Re: Issues with .NET for Informix

      ‏2011-08-12T00:30:43Z  in response to SystemAdmin
      I really do appreciate the quick response however I fear am I going in the wrong direction.
      Now the Connection won't even get past the constructor.
      When I try

      IfxConnection con = new IfxConnection();

      I get the following.
      Unable to load DLL 'iclit09b.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

      I am currently trying to locate this library within my system and see if can get a path to it. I don't mind copying X amount of files with my app but this really should be more self contained than it is.
      Thanks
      • SystemAdmin
        SystemAdmin
        1143 Posts
        ACCEPTED ANSWER

        Re: Issues with .NET for Informix

        ‏2011-08-12T01:00:06Z  in response to SystemAdmin
        I found the DLL and had to add it to my path. I also included the IfcDotNetIntrinsicModule to my app as additional content. I was able to successfully query a table this way. PLEASE inform me of any updates to the .NET clients. I still believe this solution is less than ideal. I would request if at all possible that a full installation of iConnect is not required to get this to work. This puts a large restraint on installing this application on several machines, when I have to include several steps to get it to run. A self contained assembly or set of assemblies would be more than acceptable. I full install of a large app like iConnect is really unrealistic.
        • SystemAdmin
          SystemAdmin
          1143 Posts
          ACCEPTED ANSWER

          Re: Issues with .NET for Informix

          ‏2011-08-12T01:30:31Z  in response to SystemAdmin
          Is there an x86 version of 3.50.FC8?

          I need to be able to run on more than just x64 systems as well.
          • SystemAdmin
            SystemAdmin
            1143 Posts
            ACCEPTED ANSWER

            Re: Issues with .NET for Informix

            ‏2011-08-12T02:27:50Z  in response to SystemAdmin
            Yes, the version number is 3.50.TC8
            • SystemAdmin
              SystemAdmin
              1143 Posts
              ACCEPTED ANSWER

              Re: Issues with .NET for Informix

              ‏2011-08-12T04:11:09Z  in response to SystemAdmin
              I think there is a problem with TC8 as well. No matter what address I enter as HOST in the connection string it tries to connect to 10.218.181.30

              Thanks
              • SystemAdmin
                SystemAdmin
                1143 Posts
                ACCEPTED ANSWER

                Re: Issues with .NET for Informix

                ‏2011-08-15T22:55:37Z  in response to SystemAdmin
                That is odd. I tested TC8 with dfferent hosts/IP addresses, but I could not recreate the problem. If you still get the problem, I would suggest to open a PMR.
                • SystemAdmin
                  SystemAdmin
                  1143 Posts
                  ACCEPTED ANSWER

                  Re: Issues with .NET for Informix

                  ‏2011-08-28T12:54:20Z  in response to SystemAdmin
                  Can you send me a small sample code that you used for your connection. I would just like to make sure I have the syntax right. I will try again on this during the coming week.
                • SystemAdmin
                  SystemAdmin
                  1143 Posts
                  ACCEPTED ANSWER

                  Re: Issues with .NET for Informix

                  ‏2011-08-28T14:53:25Z  in response to SystemAdmin
                  Please ignore my issue. I found the problem on my side.

                  Thanks
                  Steve
                  • SystemAdmin
                    SystemAdmin
                    1143 Posts
                    ACCEPTED ANSWER

                    Re: Issues with .NET for Informix

                    ‏2011-08-28T15:20:28Z  in response to SystemAdmin
                    To clarify the issue.
                    I found that if the Server= value is set to a server name that was defined previously, that the IP address of the Entry will be used first.

                    Meaning I had a DSN where the server name was set to cms_net.
                    If I look in my registry at Local Machine\Software\Informix\SqlHosts I find a folder for cms_net. In there is the IP address that I was seeing.

                    I tried to connect to another server named that was defined in sqlhosts on the database server and it wouldn't connect until I created the keys that matched that server.

                    This is not the behavior I was expecting.
                    • SystemAdmin
                      SystemAdmin
                      1143 Posts
                      ACCEPTED ANSWER

                      Re: Issues with .NET for Informix

                      ‏2011-08-28T15:32:43Z  in response to SystemAdmin
                      I have a new issue that is related.

                      When I try to connect to a different server I get "database locale information mismatch"
                      When we run into this with a DSN we check "Use Server Database Locale" on the environment tab of the DSN. How can I do this with .NET?

                      Is there a registry key I can set or something to accomplish this?

                      Thanks
                      • J0T0_Nhan_Do
                        J0T0_Nhan_Do
                        3 Posts
                        ACCEPTED ANSWER

                        Re: Issues with .NET for Informix

                        ‏2011-09-21T08:39:14Z  in response to SystemAdmin
                        You check first:
                        Control Panel -> Administrative Tools -> Data Source -> Add New System DSN -> Choose Informix Driver -> Test Connection Success or not?

                        http://www.connectionstrings.com/informix

                        I Tested success with
                        ConnectionString = "Dsn = you input from System DSN that you config; Driver ={INFORMIX 3.30 32 BIT}; Host =hostname; Server =myServerAddress; Service =service-name; Protocol =olsoctcp; Database =myDataBase; Uid =myUsername; Pwd =myPassword;"
            • SystemAdmin
              SystemAdmin
              1143 Posts
              ACCEPTED ANSWER

              Re: Issues with .NET for Informix

              ‏2011-08-28T14:54:19Z  in response to SystemAdmin
              This version works. Is there any way I can be advised on new releases of 3.7 that resolve this issue as well.

              Thanks
  • LudmillaB
    LudmillaB
    5 Posts
    ACCEPTED ANSWER

    Re: Issues with .NET for Informix

    ‏2011-12-20T18:57:54Z  in response to SystemAdmin
    I have the exact same problem as voast.

    The irony of it all is that I had a working example of a similar code with the 3.70 FC3 version of CSDK. The only thing I did was change "Copy Local" to true for the reference IBM.Data.Informix in Visual Studio, to be able to test my code snippet at an ISP:s IIS-server. When I changed it back, I got the same error as voast, the ExecuteReader method generated an exception. I removed IBM.Data.Informix from the GAC, but that didn't fix the problem.

    Does anybody have a solution to this problem?