testconn command

The testconn command can be used to test the database connectivity of the Db2® .NET data provider.

The testconn40 command is used to test the Db2 .NET data provider for .NET Framework 4.0.
In 64-bit IBM® data server product environments, both 32-bit and 64-bit versions of the testconn command are available:
  • The testconn40 command is the 64-bit version of a testconn command for the .NET framework 4.0. In 32-bit IBM Data Server product environments, there is only one testconn40 command, which is 32-bit.
  • The testconn40_32 command is the 32-bit version of a testconn command for the .NET framework 4.0. The testconn40_32 command is only available in 64-bit IBM Data Server product environments.

Command syntax

Read syntax diagramSkip visual syntax diagramtestconn40?-dtc-ids-idsold-validateExtendedInsightWithConnect-validateEIWithConnect-maxStepstep-number-specific-enumerateremotedbs-enumremotedbsconn-string-validateExtendedInsight-validateEI-asp-enumeratedbs-enumdbs-enumeratelocaldbs-enumlocaldbs

Command parameters

-dtc

Tests the connection for distributed transaction.

-ids

Tests the connection with the Common Informix® .NET provider (IBM.Data.Informix.dll).

Important: The Informix .NET provider (IBM.Data.Informix.dll) is deprecated and might be discontinued in a later release. Start using the Db2 .NET provider (IBM.Data.Db2.dll) to connect to Informix database servers.
-idsold

Tests the connection with Informix client SDK .NET provider. The -idsold option requires the Informix client SDK.

-validateExtendedInsight or -validateEI

Validates the db2dsdriver.cfg file structure and OPM EI monitoring configuration for the database that is mentioned in the connection string.

-validateExtendedInsightwithConnect or -validateEIwithConnect

Validates the db2dsdriver.cfg file structure and OPM EI monitoring configuration for the database that is mentioned in the connection string. Also, a connection is established to the database and reports the status of database monitoring.

-maxStep step-number
Runs only the specified number of validation steps in the testconn command. The testconn command runs validation tests in six steps:
  • Step 1: Prints the IBM .NET data provider version and the .NET framework version information.
  • Step 2: Validates the db2dsdriver.cfg file.
  • Step 3: Tests the connection to the specified database in the connection string.
  • Step 4: Validates the presence of packages by selecting rows from the SYSIBM.SYSTABLES table.
  • Step 5: Validates the presence of schema functions by calling the GetSchema() method.
  • Step 6: Tests the XA connection to the specified database in the connection string. This step is only run when the -dtc option is specified.
-specific

Tests the connection with the fix pack specific provider that is present under the netf40/specific directory.

-enumerateremotedbs or -enumremotedbs

Lists the available databases on the remote server that is specified in the connection string.

-asp

Tests the database connection for an ASP .NET application.

-enumeratedbs or -enumdbs
Enumerates the databases that are accessible from the computer where the command is issued. The -enumeratedbs or -enumdbs option requires following IBM Data Server product installation:
  • The IBM database server product.
  • The IBM Data Server Client software.
  • The IBM Data Server Runtime Client software.
-enumeratelocaldbs or -enumlocaldbs
Lists the databases available on the local computer. The -enumeratelocaldbs or -enumlocaldbs option requires following IBM Data Server product installation:
  • The IBM database server product.
  • The IBM Data Server Client software.
  • The IBM Data Server Runtime Client software.
conn-string

Specifies a connection string, which contains all information that is needed to connect to a target database.

There are total of six validation steps that are associated with testconn command. The sixth validation step is only called if -dtc option is specified. Following testconn command output example lists all six validation steps:
C:\Program Files\IBM\IBM DATA SERVER DRIVER\bin>testconn40 -dtc 
"database=sampledsn;uid=username;pwd=password"
adding MSDTC step

Step 1: Printing version info
        .NET Framework version: X.X.XXXXX.XXXX
        64-bit
        DB2 .NET provider version: X.X.X.X
        DB2 .NET file version: X.X.X.X
        Capability bits: ALLDEFINED
        Build: XXXXXXXX
        Factory for invariant name IBM.Data.DB2 verified
        Factory for invariant name IBM.Data.Informix verified
        IDS.NET from DbFactory is Common IDS.NET
        VSAI is not installed properly
        Elapsed: 1.2969165

Step 2: Validating db2dsdriver.cfg against db2dsdriver.xsd schema file
        C:\ProgramData\IBM\DB2\IBMDBCL1\cfg\db2dsdriver.cfg against 
C:\ProgramData\IBM\DB2\IBMDBCL1\cfg\db2dsdriver.xsd
        Elapsed: 0

Step 3: Connecting using "database=sampledsn;uid=username;pwd=password"
        Server type and version: DB2/NT XX.XX.XXXX
        Elapsed: 2.8594665

Step 4: Selecting rows from SYSIBM.SYSTABLES to validate existence of packages
   SELECT * FROM SYSIBM.SYSTABLES FETCH FIRST 5 rows only
        Elapsed: 0.3281355

Step 5: Calling GetSchema for tables to validate existence of schema functions
        Elapsed: 0.906279

Step 6: Creating XA connection
        DB2TransactionScope: Connection Closed.
        Elapsed: 3.2657295


Test passed.
You can also run only the first four validation steps by specifying the -maxStep step-number option:
C:\Program Files\IBM\IBM DATA SERVER DRIVER\bin>testconn40 -maxStep 4 -dtc 
"database=sampledsn;uid=username;pwd=password"
max step 4
adding MSDTC step

Step 1: Printing version info
        .NET Framework version: X.X.XXXXX.XXXX
        64-bit
        DB2 .NET provider version: X.X.X.X
        DB2 .NET file version: X.X.X.X
        Capability bits: ALLDEFINED
        Build: XXXXXXXX
        Factory for invariant name IBM.Data.DB2 verified
        Factory for invariant name IBM.Data.Informix verified
        IDS.NET from DbFactory is Common IDS.NET
        VSAI is not installed properly
        Elapsed: 1.2969165

Step 2: Validating db2dsdriver.cfg against db2dsdriver.xsd schema file
        C:\ProgramData\IBM\DB2\IBMDBCL1\cfg\db2dsdriver.cfg against 
C:\ProgramData\IBM\DB2\IBMDBCL1\cfg\db2dsdriver.xsd
        Elapsed: 0

Step 3: Connecting using "database=sampledsn;uid=username;pwd=password"
        Server type and version: DB2/NT XX.XX.XXXX
        Elapsed: 2.8594665

Step 4: Selecting rows from SYSIBM.SYSTABLES to validate existence of packages
   SELECT * FROM SYSIBM.SYSTABLES FETCH FIRST 5 rows only
        Elapsed: 0.1875024


Test passed.