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
url-spec:
sql-spec:
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.
- -info
-
Specifies that DB2Jcc displays IBM® Data Server Driver for JDBC and SQLJ driver name and version and the corresponding Db2 Connect name and version.
For IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on Db2® for z/OS®, DB2Jcc also displays the version of the IBM Data Server Driver for JDBC and SQLJ native libraries.
- -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 IBM i data servers.
- license-file-path
- The full path for the IBM Data Server Driver for JDBC and SQLJ 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 IBM 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 IBM 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 on Linux®, UNIX, and Windows systems 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.
- -validateCfg
- Specifies that DB2Jcc validates the keywords in the IBM data server driver configuration file (default name db2dsdriver.cfg). DB2Jcc issues errors for any invalid keywords that it finds in the file. -validateCfg applies only to connections that use IBM Data Server Driver for JDBC and
SQLJ type 4 connectivity.
- -path dsdriver-config-file-path
- Specifies the full path name of the IBM Data server driver configuration file. If -path dsdriver-config-file-path is not specified, DB2Jcc uses the path name in the DB2DSDRIVER_CFG_PATH environment variable.
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
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'
SELECT '*' FROM SYSIBM.SYSDUMMY1
java com.ibm.db2.jcc.DB2Jcc
-url jdbc:db2:MYDB
-user db2user -password db2pass
-sql 'SELECT '*' FROM SYSIBM.SYSDUMMY1'
C:\drivercfg\mydb2dsdriver.cfg
.java com.ibm.db2.jcc.DB2Jcc
-validateCfg -path C:\drivercfg\mydb2dsdriver.cfg