IBM Support

My java application is failing with the exception, "No Suitable Driver".

Troubleshooting


Problem

My java application is failing with the exception, "No Suitable Driver".

Symptom

java.sql.SQLException: No suitable driver

Cause

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
Check that the proper implementation class name is used.
    • 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
And check that the URL syntax is correct for the connection
    • jdbc:db2:<dbalias> for the Legacy Type 2 driver connection
    • jdbc:db2://<hostname>:<port>/<database> for the Universal and Data Server driver for JDBC.
Note: db2java.zip support has been discontinued as of v10.1, see DB2 JDBC Type 2 Driver is discontinued.

2) Check if you have DB2 Extended security enabled on the DB2 Client using the command:


    db2set -all

    If enabled, the output will show:


    [g] DB2_EXTSECURITY=YES

    If so, make sure the application userID is part of DB2ADMNS or DB2USERS groups in Windows

[{"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Programming Interface - JCC","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.7;9.5;10.1;10.5","Edition":""}]

Document Information

Modified date:
16 June 2018

UID

swg21432559