Issue with JDBC Communications link failure

Hi everyone

i am new on Gatling ( coming from Jmeter world )

I tried to etablish a jdbc connexion to find a value and use it from another request.
Using Visual Studio for example i managed to add and connect to mysql DB and execut properly my request but when executed with Gatling 3.4.1 ( from same Visual Studio ) i get this issue :

Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException:

Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago.

The driver has not received any packets from the server.

As driver i add into my Gatling/lib folder : mysql-connector-java-8.0.22.jar

import io.gatling.jdbc.Predef._

val mysqlFeeder = jdbcFeeder(“jdbc:mysql://URL:PORT”,
“user”, “pass”, "select * from … ")

val scenario = scenario(“MyScenario”)
.feed( mysqlFeeder )
.exec(session => {
println( mysqlFeeder )
session
})

setUp(
scenario.inject(atOnceUsers(1))
)

Regards

NoVa

Have you tried googling “The driver has not received any packets from the server.”?
Your issue is really not related to Gatling itself.

Hi Stephane

I thought I was realated because it work well with Visual Code itself so not link to some network issue or firewall… because it is on the same PC

I thought maybe wrong jar or wrong use of gatling

Hi Nova,

And welcome!

First, I’m not used to putting libraries in gatling/lib folder. But as your link suggests (compile dependencies), I think you should add protobuf-java as well.
That one reason to use a dependency manager (sbt, maven, gradle, …) and it is not an issue related to gatling itself.

Your println will not show anything useful anyway.
I don’t know your query (and not the column name) but I guess there is an id column:

val  scenario = scenario("MyScenario")
    .feed( mysqlFeeder  )
    .exec(session => 
      for {
        id <- session("id").validate[Long]
      } {
        println( id )
      }
      session
    })

Hi Sebastian

Thanks for the quick reply

I will try it asap and keep you inform

I add into lib because it was mention in gatling website to :

Do not forget to add the required JDBC driver jar in the classpath (lib folder in the bundle)

Regards