My java application is failing with the exception, "No Suitable Driver".
java.sql.SQLException: No suitable driver
This occurs when either the incorrect driver class name or more typically the JDBC database URL passed is not properly constructed or incorrect permission to access the driver jar files.
When a Connection request is issued, the Driver Manager asks each loaded driver if it understands the URL sent. If no driver responds that it understands the URL, then the "No Suitable Driver" message is returned.
Resolving The Problem
Verify following steps:
1) Ensure your application is configured properly with the appropriate driver files included in the CLASSPATH environment setting.
- db2java.zip for the Legacy Type 2 driver
- db2jcc.jar for the Universal and Data Server driver for JDBC
- COM.ibm.db2.jdbc.app.DB2Driver for the legacy Type 2 driver from db2java.zip
- com.ibm.db2.jcc.DB2Driver for the Universal JCC driver from db2jcc.jar
- jdbc:db2:<dbalias> for the Legacy Type 2 driver connection
- jdbc:db2://<hostname>:<port>/<database> for the Universal and Data Server driver for JDBC.
2) Check if you have DB2 Extended security enabled on the DB2 Client using the command:
If enabled, the output will show:
If so, make sure the application userID is part of DB2ADMNS or DB2USERS groups in Windows
16 June 2018