JCC Type 2 driver getUserName() returns an uppercase username unexpectedly

Technote (FAQ)


When using the following sample code, the username is returned in uppercase unexpectedly.

----- example.java ------------------------------
import java.sql.*;
import java.io.*;
import javax.sql.*;
import java.util.*;

public class example {

public static void main(String argv[]) {

Connection conn = null;
try {
if (argv.length == 4 | argv.length == 2) {
if (argv[0].equals("legacy") ){
}else if(argv[0].equals("jcc")){
System.out.println("argv[0]=[" + argv[0] + "]: incorrect driver name, should be legacy or jcc.");
else {
// print usage then terminate.
System.out.println("\nUsage: java example legacy|jcc url [username password]\n" +
" ex: java example legacy jdbc:db2:sample db2inst1 password\n" +
" ex: java example jcc jdbc:db2://localhost:55555/sample db2inst1 password\n");
if (argv.length == 4){
conn = DriverManager.getConnection(argv[1], argv[2], argv[3]);
else if (argv.length == 2){
conn = DriverManager.getConnection(argv[1]);

DatabaseMetaData dbMetaData = conn.getMetaData();

System.out.println("getUserName:" + dbMetaData.getUserName());

catch (Exception ex) {
// end of example

The following is the output of the DB2® Version 9.7 Fix Pack 6, 64 bit software.

JCC Type 2:

$ java example jcc jdbc:db2:sample hidehy hidehy

Legacy JDBC Type 2:

$ java example legacy jdbc:db2:sample hidehy hidehy

JCC Type 4:

$ java example jcc jdbc:db2://localhost:55555/sample hidehy hidehy

As shown in the sample output of JCC Type 2 driver, the username is not returned in lowercase. In DB2 Version 8.2, all three types of drivers return the username is lowercase. However in DB2 Version 9.1, Version 9.5, and Version 9.7, only JCC Type 2 drivers return usernames in all capital letters.


The current DB2 Version 9.7 Fix Pack 6 behavior works as designed. There is no commitment for future version/release updates because the JCC Type 2 driver is not case sensitive.

Document information

More support for:

DB2 for Linux, UNIX and Windows
DB2 Programming Interfaces - JCC

Software version:

8.2, 9.1, 9.5, 9.7, 9.8, 10.1

Operating system(s):

AIX, HP-UX, Linux, Linux iSeries, Linux pSeries, Linux zSeries, Solaris, Windows

Software edition:

Advanced Enterprise Server, Enterprise Server, Express, Express-C, Personal, Workgroup Server

Reference #:


Modified date:


Translate my page

Content navigation