Skip to content

io.vertx.sqlclient.ClosedConnectionException: the underlying connection may have been lost unexpectedly. #1528

@fen-nec

Description

@fen-nec

Version

5.0.0

Context

I have tried everything there is to remedy this: io.vertx.sqlclient.ClosedConnectionException: Failed to read any response from the server, the underlying connection may have been lost unexpectedly.

Trying to create a pool with bit of code that I call inside of a compose (loading the env file) in the mainverticle:

MySQLConnectOptions connectOptions = new MySQLConnectOptions()
  .setPort(3306)
  .setHost(this.appConfig.getString("MYSQL_HOST"))
  .setDatabase(this.appConfig.getString("MYSQL_DB"))
  .setUser(this.appConfig.getString("MYSQL_USER"))
  .setAuthenticationPlugin(MySQLAuthenticationPlugin.MYSQL_NATIVE_PASSWORD)
  .setPassword(this.appConfig.getString("MYSQL_PWD"));
PoolOptions poolOptions = new PoolOptions()
  .setMaxSize(5); // Configurable pool size

this.mySQLPool = MySQLBuilder
  .pool()
  .with(poolOptions)
  .connectingTo(connectOptions)
  .using(vertx)
  .build();

System.out.println("MySQL Pool initialized.");

this.mySQLPool.query("SELECT 1").execute()
  .onSuccess(rows -> System.out.println("Successfully connected to MySQL and executed a test query."))
  .onFailure(Throwable::printStackTrace);`

I have tried using version 4.5.7. Java 17, 21. I added/removed options. The same result.
I ran a test with the JDBC driver and it works fine.

Steps to reproduce

No response

Do you have a reproducer?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions