Attempt to connect to a database using Type 4 JCC driver fails with the following exception:
[jcc][t4][3.53.95] The application server rejected establishment of the connection. An attempt was made to access a database,
Using DCS DB alias or local alias name of the database in the connection string will cause this error.
Resolving The Problem
The URL format for IBM Data Server Driver for JDBC and SQLJ type 4 connectivity is:
- "jdbc:db2://<server name>: <portnumber>/<database name>";
In the Type 4 JDBC JCC driver connection string used,
- If the connection is to a DB2 for Linux,Unix,Windows server, the database name should be the Target database name in the database server, it should not be the local alias name cataloged in the client.
- If the connection is to a DB2 for z/OS server, database name is the DB2 location name that is defined during installation. All characters in the DB2 location name must be upper-case characters. The IBM Data Server Driver for JDBC and SQLJ does not convert lower-case characters in the database value to upper-case for IBM Data Server Driver for JDBC and SQLJ type 4 connectivity.
- The location name can be found by executing the following SQL statement on the server:
- SELECT CURRENT SERVER FROM SYSIBM.SYSDUMMY1;
The target database name can also be found from the DCS directory on the client using the command:
- db2 list dcs directory.
For further discussion on this topic, visit this developerWorks forum thread:
16 June 2018