Connecting .NET and IBM i with NTi.
General considerations.
Connection pool.
Starting with version 3.2.3, NTi includes a connection pool fully managed by .NET, optimizing access to IBM i programs and data.
Instead of opening and closing a connection for every request, pooling allows existing connections to be reused, reducing latency and resource consumption. It avoids the overhead of repeatedly creating QZDASOINIT jobs and ensures accurate tracking of connections to prevent the buildup of “orphan” sessions.
When pooling is enabled:
- Connections remain open and are reused by the application instead of being closed and reopened on each request.
- Performance is improved: the overhead of IP resolution, TCP connection setup, and authentication is significantly reduced.
- Connections are properly closed when no longer needed, ensuring clean and efficient management of IBM i resources.
💡Pooling is enabled by default as of NTi 3.2.3 and can be configured through the connection string.
Multi-Factor Authentication (MFA)
Starting from version 4.4.0, NTi supports the IBM i built-in multi-factor authentication (MFA) with TOTP. When opening a connection, the OTP code can be provided:
- with a callback
AdditionalFactorCallback
, triggering a user prompt. - with the connection property
AdditionalFactor
, passed directly.
💡 Introduced by IBM in the latest IBM i releases (V7R6+), MFA strengthens connection security.
For more details on enabling MFA and the full configuration on the IBM i side, see the Multi-Factor Authentication (MFA).
One instance = one TCP connection = one IBM i job.
Each instance of NTiConnection
carries a TCP socket instance to connect to the IBM i. Thus there is a strong link between the instance, the connection and the IBM i job.
When an instance of NTiConnection
is explicitly destroyed via .NET's Garbage Collector, the underlying TCP connection is instantly closed and destroyed in turn, causing the IBM i job to stop. This mechanism guarantees total user control of connections.
Connection string.
Like most database access providers, NTi uses a login string to obtain IBM i login information (username, password, etc.). This connection string may contain sensitive information. There are many ways to secure the management of the connection string and configuration files. Possible keywords for the NTi connection string are specified in the NTiConnection
property details below.
Please refer to the official .NET documentation and recommendations for implementation.
ADO.NET implementation.
This class implements the usual methods and properties of the ADO.NET model for database access operations:
Open()
Close()
CreateCommand()
BeginTransaction()
Commit()
Rollback()
- ...
In this way, NTi integrates into any existing application developed with other vendors, such as ODBC or OleDB drivers.
💡 Find documentation for this default implementation on any ADO.NET documentation, for example via the documentation of the
System.Data.Common
namespace.