DRDA Connectivity Test — Overview
drdatest is a small diagnostic utility that verifies an IBM® Informix® server is reachable and answering queries over DRDA. It resolves an sqlhosts entry to a host and port, connects to the server, runs a single sanity query, and reports the outcome through standard output and a distinct exit code.
It is a diagnostic and nothing more. It makes no lasting change to the client or the server, it configures nothing, and it distinguishes failure modes by exit code so that a script calling it can tell why a connection failed rather than merely that it failed.
Why a dedicated tool
Informix exposes DRDA through the drsoctcp and drsocssl listeners, which are separate from the native SQLI listeners (onsoctcp). A server can be perfectly healthy on SQLI while its DRDA listener is down, misconfigured, or listening on an unexpected port. Testing DRDA therefore needs a DRDA client, not an Informix one.
The standard Informix client tools cannot do this at all. dbaccess speaks SQLI and only SQLI; so does ESQL/C. Neither has any DRDA capability whatsoever. Point either of them at a server and they will connect happily over onsoctcp and report a healthy database — while telling you precisely nothing about whether the DRDA listener is alive. A green dbaccess session is not evidence that DRDA works, and treating it as such is the usual reason a DRDA fault goes undiagnosed.
That is the gap this tool fills. Verifying DRDA requires a client that speaks it, which in practice means the IBM® Data Server Driver for ODBC and CLI — the same driver a DRDA application would use.
The most common diagnostic confusion this tool removes is the difference between “I could not reach your server” and “I reached your server and it refused me”. DRDA reports both under the same SQLSTATE, so tools that classify on SQLSTATE alone cannot separate them — see Exit codes.
Why this utility is written in C
The utility is intentionally written in C rather than Python, Ruby, Java, Go, or another higher-level language. The objective is not simply to prove that an application can connect to Informix®. It is to validate the native IBM® DRDA client implementation and the Informix DRDA gateway with the minimum possible software layers between the test program and the server.
By using the IBM CLI API directly from C, the utility exercises the same native DRDA shared or static library that official compiled IBM applications use. That is the shortest practical execution path between application and server, so the test reflects the behaviour of the native DRDA implementation rather than that of an intermediary runtime or framework.
Higher-level languages typically introduce one or more additional abstraction layers:
- Language-specific database modules
- ODBC managers
- Driver adapters
- Runtime bridges
- JDBC providers
- Framework-specific connection libraries
Each of these can influence connection establishment, TLS negotiation, authentication, configuration processing, error reporting, character-set conversion, and connection attributes. A successful or failed connection may therefore reflect the behaviour of the language runtime or adapter rather than that of the underlying IBM DRDA client library or the Informix DRDA gateway — which is precisely the ambiguity this tool exists to remove.
The intended execution path is:
drdatest
↓
IBM CLI API
↓
IBM DRDA Client Library
↓
TCP or TLS
↓
Informix DRDA Gateway
↓
sysmaster
The utility also assumes that any system expected to execute native DRDA applications already has the required IBM DRDA client libraries installed. If those libraries are missing it reports a test failure rather than substituting an alternative implementation — an official DRDA application would fail under the same circumstances, so this is an accurate representation of the client environment.
The result is a small, deterministic utility that validates the complete native DRDA connection path with minimal abstraction, making failures easier to diagnose and ensuring the test reflects the behaviour of the IBM DRDA client and the Informix DRDA gateway rather than an intermediary language runtime or framework.
The two SDK roles
Two software roots are involved, with strictly separate jobs. Keeping them distinct is the single most important thing to understand about the tool.
| Root | Role |
|---|---|
| DB2DIR | The IBM Data Server Driver for ODBC and CLI. This is the DRDA client. It provides sqlcli1.h, libdb2, and the DRDA transport that reaches the Informix listeners. Used to compile, link and run. |
| INFORMIXDIR | Used only to locate and parse sqlhosts, translating a server name into the host, port and protocol needed to build the connection string. No Informix client library is linked. |
Because the CLI driver is the DRDA implementation, any host that runs drdatest needs that driver present — a host without it could not speak DRDA even if the binary started. Build and deployment detail is kept in the internal documentation.
What it does, in order
- Locates sqlhosts — INFORMIXSQLHOSTS if set, otherwise $INFORMIXDIR/etc/sqlhosts.
- Matches the requested server name and rejects anything that is not drsoctcp or drsocssl. Group entries and g= failover options are out of scope.
- Resolves the service name to a numeric port, either directly when it is all digits or through getservbyname.
- Connects with an explicit connection string. It does not catalog nodes or databases and needs neither db2cli.ini nor db2dsdriver.cfg.
- Runs one sanity query and prints the result.
The sanity query
SELECT current FROM sysmaster:sysdual;
The purpose is to prove the session can execute SQL, which is a distinct failure mode from connecting — a connection can authenticate and still be unable to run a statement.
sysmaster:sysdual is a guaranteed single-row table and CURRENT is a built-in, so the query depends on no catalog layout whatsoever and needs no FIRST clause. The name is fully qualified, which means the query returns the same result regardless of which database the session attached to — making the target database a free parameter rather than a fixed one.
What this is not
- Not a configuration tool. It tests connectivity; the target server must already have a DRDA listener configured.
- Not a credential tester. Authentication outcomes are reported, but probing credentials is not the tool's purpose.
- Not a performance measure. It makes one connection and runs one statement.