cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Community Helping Community

721
Views
0
Helpful
0
Replies
Beginner

Connecting CCX Informix with .NET

Hello, 

 

I'm having a lot of issues when trying to connect with Informix database using Visual Studio 2017 version 15.8.8. I've created a new project with .NET Framework 4.6.1 with the MVC example. I already tried to use the IBM.Data.Informix, IBM.Data.DB2 but both returns me the same error:

 

Could not load file or assembly 'IBM.Data.DB2' or one of its dependencies. 

 

I'm starting to use .NET and i've never worked with Informix before, so I'm not sure if I need to install anything before using the lib. By the moment, I've created a reference to the IBM.Data.DB2 inside the project, but it still doesn't work. 

 

Here's my code:

using System;
using IBM.Data.DB2;

namespace TestCCX.ContextConn
{
    public class ContextConnect
    {
        public void testConnectionByDB2()
        {
            String connectionString = "Database=db_test;Server=10.3.1.14:1504;User ID=test;Password=12345;";

            Boolean testStatus = true;

            try
            {
                using (DB2Connection conn = new DB2Connection(connectionString))
                {
                    conn.Open();
                    Console.WriteLine("Connected");
     
                }
            }
            catch (DB2Exception exc)
            {
                Console.WriteLine("Error Message: {0}", exc.Message);
                foreach (DB2Error error in exc.Errors)
                    Console.WriteLine("Error: ({1}): {0}", error.Message,
                    error.NativeError);

                testStatus = false;
            }
            Console.WriteLine(testStatus);
        }
    }
}

 

Can anyone please help me? 

 

Thank you, 

Bruna Toledo.

CreatePlease to create content
Content for Community-Ad
FusionCharts will render here