DB2 10.5 for Linux, UNIX, and Windows

DB2Jcc - IBM Data Server Driver for JDBC and SQLJ diagnostic utility

DB2Jcc verifies that a data server is configured for database access.

To verify the connection, DB2Jcc connects to the specified data server, executes an SQL statement, and executes a java.sql.DatabaseMetadata method.

Authorization

The user ID under which DB2Jcc runs must have the authority to connect to the specified data server and to execute the specified SQL statement.

DB2Jcc syntax

Read syntax diagramSkip visual syntax diagram
>>-java--com.ibm.db2.jcc.DB2Jcc--+-----------+------------------>
                                 '- -version-'   

>--+----------------------------------------+------------------->
   '- -db2ConnectVersion--license-file-path-'   

>--+-----------------+--+------------------+-------------------->
   '- -configuration-'  '- -expirationDate-'   

>--+---------------------------------+--+--------+-------------->
   '- -expirationDateWithLicenseType-'  '- -help-'   

>--+----------------------------------------------------------------------------------+-><
   '-url-spec--+---------------------------------------+--+----------+--+-----------+-'   
               '- -user--user-ID-- -password--password-'  '-sql-spec-'  '- -tracing-'     

url-spec:

Read syntax diagramSkip visual syntax diagram
>>-+----------------------------------------------------+------><
   '- -url--+-jdbc:db2://server-+---------+-/database-+-'   
            |                   '-:--port-'           |     
            '-jdbc:db2:database-----------------------'     

sql-spec:

Read syntax diagramSkip visual syntax diagram
   .- -sql--'--SELECT * FROM SYSIBM.SYSDUMMY1--'-.   
>>-+---------------------------------------------+-------------><
   '- -sql--'--sql-statement--'------------------'   

DB2Jcc parameters

-help
Specifies that DB2Jcc describes each of the options that it supports. If any other options are specified with -help, they are ignored.
-version
Specifies that DB2Jcc displays the driver name and version.
-db2ConnectVersion
Specifies that DB2Jcc displays the DB2 Connect™ version that corresponds to the IBM® Data Server Driver for JDBC and SQLJ version.

This option is supported only for connections to DB2® for z/OS® or DB2 for i data servers.

license-file-path
The full path for the db2jcc_license_cisuz.jar license file.
-configuration
Specifies that DB2Jcc displays driver configuration information.
-expirationDate
Specifies that DB2Jcc displays the date on which the client license file for connections to DB2 for z/OS or DB2 for i data servers expires.
-expirationDateWithLicenseType
Specifies that DB2Jcc displays:
  • The date on which the client license file for connections to DB2 for z/OS or DB2 for i data servers expires.
  • The type of license: temporary or permanent
-url
Specifies the URL for the data server for which the connection is being tested. The URL can be a URL for IBM Data Server Driver for JDBC and SQLJ type 2 connectivity or IBM Data Server Driver for JDBC and SQLJ type 4 connectivity. The variable parts of the -url value are:
server
The domain name or IP address of the operating system on which the database server resides. server is used only for type 4 connectivity.
port
The TCP/IP server port number that is assigned to the data server. The default is 446. port is used only for type 4 connectivity.
database
A name for the database server for which the profile is to be customized.
If the connection is to a DB2 for z/OS server, database is the DB2 location name that is defined during installation. All characters in this value must be uppercase characters. You can determine the location name by executing the following SQL statement on the server:
SELECT CURRENT SERVER FROM SYSIBM.SYSDUMMY1;

If the connection is to a DB2 for Linux, UNIX, and Windows server, database is the database name that is defined during installation.

If the connection is to an IBM Informix® data server, database is the database name. The name is case-insensitive. The server converts the name to lowercase.

If the connection is to an IBM Cloudscape server, the database is the fully-qualified name of the file that contains the database. This name must be enclosed in double quotation marks ("). For example:
"c:/databases/testdb"
-user user-ID
Specifies the user ID that is to be used to test the connection to the data server.
-password password
Specifies the password for the user ID that is to be used to test the connection to the data server.
-sql 'sql-statement'
Specifies the SQL statement that is sent to the data server to verify the connection. If the -sql parameter is not specified, this SQL statement is sent to the data server:
SELECT * FROM SYSIBM.SYSDUMMY1
-tracing
Specifies that tracing is enabled. The trace destination is System.out.

If you omit the -tracing parameter, tracing is disabled.

Examples

Example: Test the connection to a data server using IBM Data Server Driver for JDBC and SQLJ type 4 connectivity. Use the default SQL statement to test the connection. Enable tracing for the test.

java com.ibm.db2.jcc.DB2Jcc 
-url jdbc:db2://mysys.myloc.svl.ibm.com:446/MYDB
-user db2user -password db2pass -tracing
Example: Test the connection to a data server using IBM Data Server Driver for JDBC and SQLJ type 2 connectivity. Use the following SQL statement to test the connection:
SELECT COUNT(*) FROM EMPLOYEE
Disable tracing for the test.
java com.ibm.db2.jcc.DB2Jcc 
-url jdbc:db2:MYDB
-user db2user -password db2pass
-sql 'SELECT COUNT(*) FROM EMPLOYEE'