Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Get started with the IBM Data Server .NET Provider for Informix

Rajendra Kamath (rajkamat@in.ibm.com), Manager, Informix Client, IBM
Rajendra Kamath photo
Rajendra Kamath currently leads the Informix Client team that includes .NET, ODBC, JDBC, ESQL-C drivers for applications targeting the Informix Dynamic Server. His primary focus has been towards the development of the .NET drivers for Informix.
Brent Gross (gross@ca.ibm.com), Data Management Application Enablement, IBM
Author Photo: BRent Gross
Brent Gross is a .NET architect for IBM data servers with IBM Information Management Development in the Toronto Lab. He has more than 20 years of experience with IBM and has been developing for DB2 since 1995. His responsibilities have included architecture and development of stored procedure support and client interfaces. Brent has presented at many Information Management and user group conferences. His current role is the architect of the .NET support for IBM data servers.

Summary:  The IBM Data Server .NET Provider supports application development for IBM® Informix®. It is available for download as part of the Informix Client Software Development Kit (SDK). This article describes the two .NET providers that support .NET application development for Informix, and highlights the benefits of using the Data Server .NET Provider. The article also provides examples to help you quickly get started using the IBM Data Server .NET Provider.

Date:  22 Jul 2010
Level:  Intermediate PDF:  A4 and Letter (374KB | 14 pages)Get Adobe® Reader®
Also available in:   Chinese

Activity:  12772 views
Comments:  

Introduction to the .NET providers for application development with Informix

This section provides a look at the differences between the two .NET providers that you can use for application development with Informix:

  • IBM Informix .NET Provider
  • IBM Data Server .NET Provider

IBM Informix .NET Provider

The IBM Informix .NET Provider is also referred to as the CSDK .NET Provider. It is available for download as part of the Informix Client SDK. This .NET provider works only with Informix and uses the SQLI protocol for communication with Informix servers. The IBM Informix .NET Provider is no longer being enhanced for new .NET APIs.

IBM Data Server .NET Provider

The IBM Data Server .NET Provider is also referred to as the Common .NET Provider. It is available for download as part of the Informix Client SDK (version 3.50xC6 or later) or the IBM Data Server Driver Package. This .NET provider supports both Informix (V11.10 or later) and DB2® databases and uses the DRDA protocol for communication with data servers. The IBM Data Server .NET Provider delivers the next generation of .NET provider capability for application development. It provides extensive capabilities and features, especially in the area of web application development, entity framework, and Visual Studio support. For these reasons, it is the preferred .NET provider for new client development.

The IBM Data Server .NET Provider actually comprises two .NET provider assemblies that target specific application development requirements:

  • IBM.Data.DB2.dll — Also referred to as the DB2 .NET Provider. Although the name of the provider indicates DB2, it is in fact the single .NET provider for IBM database servers including DB2 and Informix. It is the recommended and preferred .NET provider for all clients targeting DB2 and new application development targeting Informix (Version 11.10 or later).
  • IBM.Data.Informix.dll — Also referred to as the Common IDS .NET Provider. This assembly has been specifically created to help existing applications that were developed using the CSDK .NET Provider (SQLI protocol) to use the latest DRDA protocol support. It has additional support for some of the earlier Informix client features and is targeted only for .NET application development for Informix.

Why move to IBM Data Server .NET for Informix?

Table 1 provides a side-by-side comparison of the capabilities in the IBM Informix .NET Provider and the IBM Data Server .NET Provider.


Table 1. Comparison of Informix .NET Provider with IBM Data Server .NET Provider
Feature IBM Informix .NET Provider IBM Data Server .NET Provider
Protocol support SQLI DRDA
Informix server support Any supported IDS version Informix v11.10 or later only
LOB (BLOB & CLOB) column size limit 4 TB 2 GB
Support for .NET framework 3.0, 3.5 No Yes
Support for LINQ (Entity framework) No Yes
Silverlight and AJAX development support No Yes
ASP.NET dynamic data support No Yes
ADO.NET Entity Data Modeling (EDM) support No Yes
Visual Studio Tools for Office (VSTO) development using EDM No Yes
VSAI support for VS 2008, web application development support, WPF and WWF enhancements No Yes
VSAI designers to create tables, procedures, functions and triggers, run procedures and functions No Yes

In addition to the above, performance tests have shown the Data Server .NET Provider (DRDA) to be more scalable in comparison with the Informix .NET Provider (SQLI) for performance intensive applications.


Installing the IBM Data Server .NET Provider

To use the IBM Data Server .NET Provider, you first need to install the IBM Data Server Driver Package. This package contains the essential drivers and libraries for various programming language environments including .NET, Java (JDBC and SQLJ), C/C++ (ODBC and CLI), and open source languages such as PHP and Ruby.

Use one of the following two methods to download and install the Data Server Driver Package:

  • Download and install the IBM Informix Client SDK (refer to the Resources section for the download link). The latest version of the SDK is 3.50xC6 and it includes the IBM Data Server Driver. As shown in Figure 1, after installation of the Informix Client SDK completes, you have the option of also installing the IBM Data Server Driver. To do so, select the check box for Launch IBM Data Server Driver Installer and click Finish.

    Figure 1. Using the IBM Informix Client SDK
    shows option to install IBM Data Server Driver

  • Separately download and install the IBM Data Server Driver Package (refer to the Resources section for the download link).

After using one of the two methods described above to install the IBM Data Server Driver Package, your next step is to download and install the IBM Database Add-Ins for Visual Studio (refer to the Resources section for the download link). The Database Add-Ins enable you to leverage the Visual Studio IDE tools and features for Informix and DB2.


Testing the IBM Data Server .NET Provider setup after installation

After installing IBM Data Server .NET Provider, go to the install path and locate the file named testconn20.exe. You can use this tool to perform a quick connection test to Informix through the Data Server .NET Provider.

When testing a connection using the DB2 .NET Provider, the syntax to use the tool is:

testconn20.exe database=<db name>; server=<IP address|localhost>:<port number>; 
    userid=<userID>; password=<password>

Figure 2 shows a screenshot of the tool being used.


Figure 2. Using the testconn20 connection test utility
Screenshot of testconn20.exe command being issued and the resultign output.

As shown in Figure 2, if the test is successful, the output from the tool includes the following:

  • Step 1: Version information
  • Step 2: Connection information for user, password, server, and elapsed time
  • Step 3: Results from attempting a SELECT statement
  • Step 4: Results from validation of schema functions
  • "Test passed" message

When testing a connection using the Common IDS .NET Provider, the syntax to use the tool is:

testconn20.exe -ids database=<db name>; server=<IP address|localhost>:<port number>; 
    userid=<userID>; password=<password>

Here is an example:

testconn20.exe -ids database=perf;server=localhost:9092;
    userid=informix;password=informix123

Note: The port number you enter is the port used for DRDA. To determine what port number to use when Informix is installed on Windows®, go to the C:\WINDOWS\system32\drivers\etc directory and open the file named services. Locate the entry for the drda communication port to determine the port number to use on the communication string. For example, on the following entry the port number is 9092:
svc_drda_1 9092/tcp #svc_drda_1

For more information on configuring Informix for DRDA communications protocol, refer to the Informix Information Center (link provided in the Resources section).


.NET application development using the IBM Data Server .NET Provider

Listing 1 illustrates how to connect to Informix using the DB2 .NET Provider that is included as part of the IBM Data Server .NET Provider.


Listing 1. Connect to Informix using the DB2 .NET Provider

String connectionString = "Database=perf;Server=localhost:9092;User ID=informix;Password=
informix123;";
  
DB2DataReader rd;
  int i = 0;
  Boolean testStatus = true;

  try
  {
       using (DB2Connection conn = new DB2Connection(connectionString))
       {
            conn.Open();

            using (DB2Command cmd = conn.CreateCommand())
            {
                 cmd.CommandText = "select * from simpletable";
                 rd = cmd.ExecuteReader();
                 rd.Read();
                 do
                 {
                      if (rd.HasRows)
                      {
				  ///Assuming the table has two columns
                          Console.WriteLine("{0}: {1}", rd[0], rd[1]);
                      }

                 } while (rd.Read());

            }
        }
   }
   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;
   }
     return testStatus;

Listing 2 illustrates how to connect to Informix using the Common IDS .NET Provider.


Listing 2. Connect to Informix using the Common IDS .NET Provider

String connectionString = "Database=perf;Server=localhost:9092;User ID=informix;
Password=informix123;";

IfxDataReader rd;
int i = 0;
Boolean testStatus = true;

try
{
     using (IfxConnection conn = new IfxConnection(connectionString))
     {
          conn.Open();

          using (IfxCommand cmd = conn.CreateCommand())
          {
              cmd.CommandText = "select * from simpletable";

              rd = cmd.ExecuteReader();
              rd.Read();
              do
              {
                   if (rd.HasRows)
                   {
				//Assuming the table has two columns
                        Console.WriteLine("{0}: {1}", rd[0], rd[1]);
                   }

              } while (rd.Read());

          }
      }
  }
  catch (IfxException exc)
  {
       Console.WriteLine("Update: {0}", exc.Message);
       foreach (IfxError error in exc.Errors)
           Console.WriteLine("Error: ({1}): {0}", error.Message, 
           error.NativeError);

       testStatus = false;
  }
  return testStatus;

Using the Visual Studio Add-In

Follow these steps to use the Visual Studio Add-In to connect to the database:

  1. From the Visual Studio menu (Figure 3), select Tools > Connect to Database....

    Figure 3. Connect to Database option under Tools menu
    Screenshot of Visual Studio menu with Tools > Connect to Database... selected

  2. The Change Data Source window (Figure 4) lists the supported data sources. To connect to Informix through the DB2 .NET Provider, select IBM DB2, IDS and U2 Servers (this is the preferred data source to use). To connect to Informix through the Common IDS .NET Provider, select IBM IDS Server. After making your selection, click OK.

    Figure 4. Select data source
    Screenshot of Change Data Source window with IBM DB2, IDS, and U2 Servers selected

  3. From the Add Connection window, enter or select appropriate values for the server name, User ID, Password, and database name fields. The server name is in the format:
    <IP address|localhost>:<port number>

    Figure 5 shows the Add Connection window when you are connecting using the DB2 .NET Provider.



    Figure 5. Add connection using DB2 .NET Provider
    Screenshot of Add Connection window showing parameters for DB2 .NET Provider connection

    Figure 6 shows the Add Connection window when you are connecting using the Common IDS .NET Provider.



    Figure 6. Add connection using the Common IDS .NET Provider
    Screenshot of Add Connection window showing parameters for Common Informix .NET Provider connection

  4. Test the connection by clicking Test Connection at the bottom of the Add Connection window. If the connection information you entered is correct and the connection is made, you receive a "Test connection succeeded" response message (Figure 7). Click OK to clear the message.

    Figure 7. Test connection successful
    Message returned from Visual Studio indicating the connection test was successful.

  5. Back on the Add Connection window, click OK. Once the connection is added, Server Explorer includes the connection object under Data Connections (Figure 8).

    Figure 8. Connection added to Server Explorer
    Informix listed as a connection object under Data Connections in Server Explorer

The instructions above provide a simple description of how to start using the IBM Database Add-Ins for Microsoft Visual Studio. For more details, refer to the appropriate links in the Resources section.


Conclusion

This article serves as a quick guide for Informix users to start using the IBM Data Server .NET Provider. It provides an introductory level description of the two .NET providers that support .NET application development for Informix and highlights the benefits of using the IBM Data Server .NET Provider over the Informix .NET Provider. The article also provides details on using the IBM Data Server .NET Provider and Visual Studio Add-Ins with IDS. You should now be able to use this information as a foundation for tasks such as building applications, creating and altering complex database objects using designers, and creating a data web service and deploying it to enable easy access Informix or DB2 databases from your web applications.


Resources

Learn

Get products and technologies

Discuss

About the authors

Rajendra Kamath photo

Rajendra Kamath currently leads the Informix Client team that includes .NET, ODBC, JDBC, ESQL-C drivers for applications targeting the Informix Dynamic Server. His primary focus has been towards the development of the .NET drivers for Informix.

Author Photo: BRent Gross

Brent Gross is a .NET architect for IBM data servers with IBM Information Management Development in the Toronto Lab. He has more than 20 years of experience with IBM and has been developing for DB2 since 1995. His responsibilities have included architecture and development of stored procedure support and client interfaces. Brent has presented at many Information Management and user group conferences. His current role is the architect of the .NET support for IBM data servers.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management
ArticleID=501079
ArticleTitle=Get started with the IBM Data Server .NET Provider for Informix
publish-date=07222010
author1-email=rajkamat@in.ibm.com
author1-email-cc=
author2-email=gross@ca.ibm.com
author2-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.

Special offers