I recently ran into this problem when I connected to DB2 from a Glassfish server. To do this, I followed these steps and resolved this issue. Please check it below.
step1) I checked the details of DB2 in the Domain.xml file. I only saw the username, pwd, databaseName, server_name, port number, but I do not see DriverType. Tool Driver Type 2 or 4.
2) to add the type of driver that I registered in the Glassfish server admin console
Resources -> JDBC -> Connection Pool -> our pool - add an additional property
I added here since drivertype is 4.
Therefore, my problem is resolved.
Thank you, Ramaya Pillala.
source share