Programming applications to use the IBM Data Server Provider for .NET
Programming applications to use the IBM® Data Server Provider for .NET requires understanding
of available features in the IBM Data Provider for .NET. After you determine the requirement of your
application, you can leverage available features in the IBM Data Provider for .NET.
Generic coding with the ADO.NET common base classes
The .NET Framework, versions 2.0, 3.0, and 3.5, features a namespace called System.Data.Common
, which features a set of base classes that can be shared by any .NET data provider. This facilitates a generic ADO.NET database application development approach, featuring a constant programming interface across different databases.
Connecting to a database from an application using the IBM Data Server Provider for .NET
When using the IBM Data Server Provider for .NET, a database connection is established through the DB2Connection
class.
Connection pooling with the IBM Data Server Provider for .NET
When a connection is first opened against a Db2 database, a connection pool is created. As connections are closed, they enter the pool, ready to be reused within the same process by other applications that need connections.
Creating a trusted connection with IBM Data Server Provider for .NET
You can create a trusted connection with the .NET provider with the TrustedContextSystemUserID and TrustedContextSystemPassword connection string keywords.
SQL data type representation in ADO.NET database applications
ADO.NET applications can reference Db2® SQL data type values as parameter values and use these parameters values as part of SQL statement. You must reference appropriate IBM Data Server Provider for .NET data type values and .NET Framework data type values to prevent possible data truncation or data loss.
Issuing SQL statements from a .NET application
You can issue SQL statements through a DB2Command
class with its methods ExecuteReader()
and ExecuteNonQuery()
, and its properties CommandText
, CommandType
, and Transaction
.
Reading result sets from an application using the IBM Data Server Provider for .NET
When using the IBM Data Server Provider for .NET, the reading the result sets is done through a DB2DataReader
object. The DB2DataReader
method, Read()
is used to advance to the next row in the result set.
Calling stored procedures from .NET applications
.NET applications can call stored procedures with a DB2Command object.
Simultaneously accessing the result sets returned by CURSOR type output parameters
When using the IBM Data Server Provider for .NET, the DB2Type.Cursor is specified to simultaneously access all the cursors in output parameters.
Tracing IBM Data Server Provider for .NET
You can trace the activity of the IBM Data Server Provider for .NET by setting environment variables or by using an application configuration file.
Optimizing queries in .NET applications using pureQuery
The .NET client drivers can leverage features found in pureQuery technology. These features enables existing .NET application queries to execute as static SQL. Static queries avoid the need to prepare certain statements at runtime. This can lead to improved security and performance in your applications.
The Microsoft Entity Framework support with the IBM Data Server Provider for .NET
You can generate EDM schemas, write and execute Entity SQL, and write and execute LINQ statements with the IBM Data Server Provider for .NET and the Microsoft Entity Framework.
IBM Data Server Provider for .NET support for the Microsoft SQL Server Reporting Services
Microsoft SQL Server Reporting Services (SSRS) can connect to a Db2 database server by using an ODBC, OLE DB, or Db2 (IBM Data Server Provider for .NET ) embedded connection type.
Using the Enterprise Library data access module
The Enterprise Library is a collection of application blocks designed to assist developers with common development challenges. Application blocks are provided as source code that can be used as is or modified for development projects.