Database is not selected
Hello,
vertx version : 4.0.0-milestone3 using vertx reactive mysql client simple code to reproduce: MySQLConnectOptions.setDatabase and use a connection pool to query simple SELECT statements returns "No database selected" error randomly on Pool.query() . I am guessing the database is not set for all the connections in the pool.
5.5.60-MariaDB server
Actually upon doing second test, it appears that the database is not set in any of the connections in the connection pool.
I have just tested with a MariaDB 5.5.59 server and it works fine for me, can you provide more details?
Here is the code I use: MySQLConnectOptions mc = new MySQLConnectOptions().setPort(3000).setHost("dbhost").setDatabase("database").setUser("user").setPassword("secret").setSslMode(SslMode.VERIFY_CA).setPemTrustOptions(new PemTrustOptions().addCertPath("/app/ca-cert.pem")).setCachePreparedStatements(false);
PoolOptions poolOptions = new PoolOptions().setMaxSize(5); MySQLPool _dbPool = MySQLPool.pool(vertx, mc, poolOptions);
for (int i = 0; i < 200; i++) { _dbPool.getConnection(r -> {
if (r.succeeded()) {
SqlConnection con = r.result();
con.query(query, ar -> {
con.close();
if (ar.succeeded()) {
System.out.println("Got " + ar.result().size() + " rows ");
promise.complete(ar.result().size());
} else {
System.out.println("Failure: " + ar.cause().getMessage());
promise.fail(ar.cause().getMessage());
}
});
}
});
}
If I run "Use database" sql before every query the database is selected and results are returned. Otherwise it just displays: Failure: No database selected No database selected
The db server is on centos 7 linux, while vertx runs on Fedora 30.
Is there a way to debug this?