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
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.
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
- 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
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
SELECTstatement - 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:
- From the Visual Studio menu (Figure 3), select Tools > Connect to
Database....
Figure 3. Connect to Database option under Tools menu
-
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
-
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
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
- 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
- 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
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.
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.
Learn
- This
topic
in the Informix
Information Center provides details on configuring DRDA protocol for use with
Informix.
-
"DB2 for
Visual Studio 2005 developers, Part 1: Overview of IBM Database Add-ins for Visual Studio 2005"
(developerWorks, December 2005) provides an overview of the functionality provided by IBM for Visual Studio 2005.
-
"Develop a sample application using
LINQ programming and the ADO.NET Entity Framework with IBM DB2, IDS, and U2 servers"
(developerWorks, March 2009) provides an overview of LINQ programming and the Entity Framework.
-
"Create IBM Data Web Services
using IBM Database Add-Ins for Visual Studio"
(developerWorks, February 2009) shows you how the IBM Database Add-Ins for Microsoft Visual Studio tool set supports IBM data server
web services development.
- Use the
Informix area
on developerWorks to get the resources you need to advance your Informix skills.
Get products and technologies
- Download the
IBM Informix Client Software Development Kit (SDK).
- Download the
IBM Data Server Driver Package.
- Download the
IBM Database Add-Ins for Visual Studio.
- Download
a trial version of Informix.
- Download the
IBM product evaluation versions
or
explore
the online trials in the IBM SOA Sandbox and get your hands on
application development tools and middleware products from
DB2®, Lotus®, Rational®, Tivoli®, and
WebSphere®.
Discuss
- Participate in the discussion forum.
- Check out
developerWorks
blogs and get involved in the
developerWorks community.

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 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.




