jdbc: java.sql.SQLException: No suitable driver found for jdbc:sqlserver

I am getting java.sql.SQLException: No suitable driver found for jdbc:sqlserver: exception. i have included following dependency in my build.gradle file ‘implementation group: ‘com.microsoft.sqlserver’, name: ‘mssql-jdbc’, version: ‘8.4.1.jre11’’.

I also tried including ‘Class.forName(“com.microsoft.sqlserver.jdbc.SQLServerDriver”)’, it did not help. Now i am getting ‘java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver’.

2 possibilities:

  1. the jar is not in the classpath
  2. the jar in your local cache was corrupted during download and can’t be unzipped, so the JVM just skips it silently. Try to locate it and check if you can unzip it. If not, remove it to trigger download again

I have the same issue locally and on the Frontline.

The jar is definetely in the classpath.

These drivers work when I connect a postgresql.

Stéphane, could you think of any other reason or it is just a bug?

Also, I couldn’t find a support link on the Frontline page, where I run the tests.

Regards
Serhii Tokmakov

Your way of adding the dependency is wrong.
You shouldn’t be editing your module’s classpath on IntelliJ.
Instead, you should add a dependency in your gradle build. This way, the dependency will be there when running the gatling-gradle-plugin and when packaging for Gatling Enterprise (formerly known as FrontLine).

Also, I couldn’t find a support link on the Frontline page, where I run the tests.

There’s a big “Support” button on the web UI. And links to support on our pages on the AWS and Azure marketplaces, if you purchase from there.

Cheers,

Thank you!

It worked with this piece:

dependencies {
gatling ‘postgresql:postgresql:9.1-901-1.jdbc4’
}