DB2 Version 9.7 for Linux, UNIX, and Windows

testconn command

The testconn command can be used to test the database connectivity of the DB2® .NET data provider.
There are two versions of the testconn command. The testconn20 command is used to test the DB2 .NET data provider for .NET Framework 2.0 and 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 testconn20 command is the 64-bit version of a testconn command for the .NET framework 2.0. In 32-bit IBM Data Server product environments, there is only one testconn20 command, which is 32-bit.
  • 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 testconn20_32 command is the 32-bit version of a testconn command for the .NET framework 2.0. The testconn20_32 command is only available in 64-bit IBM Data Server product environments.
  • The testconn40_32 command is the 32-bit version of a testconn command for the .NET framework 4.0. The testconn20_32 command is only available in 64-bit IBM Data Server product environments.

Command syntax

Read syntax diagramSkip visual syntax diagram
>>-+-testconn20-+--+-+------------------------------------------+--conn-string-+-><
   '-testconn40-'  | +- -dtc------------------------------------+              |   
                   | +- -ids------------------------------------+              |   
                   | +- -idsold---------------------------------+              |   
                   | +-+- -validateExtendedInsightWithConnect-+-+              |   
                   | | '- -validateEIWithConnect--------------' |              |   
                   | +- -maxStep--step-number-------------------+              |   
                   | +- -specific-------------------------------+              |   
                   | '-+- -enumerateremotedbs-+-----------------'              |   
                   |   '- -enumremotedbs------'                                |   
                   +-+- -validateExtendedInsight-+-----------------------------+   
                   | '- -validateEI--------------'                             |   
                   +- -asp-----------------------------------------------------+   
                   +- -discover------------------------------------------------+   
                   +-+- -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).

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

-discover
Lists the DB2 servers that are accessible through the DB2 administration server (DAS). The -discover 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.
-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>testconn20 -dtc 
"database=sampledsn;uid=username;pwd=password"
adding MSDTC step

Step 1: Printing version info
        .NET Framework version: 2.0.50727.3615
        64-bit
        DB2 .NET provider version: 9.0.0.2
        DB2 .NET file version: 9.7.3.2
        Capability bits: ALLDEFINED
        Build: 20101113
        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 09.07.0003
        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>testconn20 -maxStep 4 -dtc 
"database=sampledsn;uid=username;pwd=password"
max step 4
adding MSDTC step

Step 1: Printing version info
        .NET Framework version: 2.0.50727.3615
        64-bit
        DB2 .NET provider version: 9.0.0.2
        DB2 .NET file version: 9.7.3.2
        Capability bits: ALLDEFINED
        Build: 20101113
        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 09.07.0003
        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.