cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1402
Views
0
Helpful
0
Replies

Connecting CCX Informix with .NET

brunatoledo
Level 1
Level 1

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.

0 Replies 0
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: