Java Vertx,通过JDBC客户端连接到数据库阻塞
我使用的是vertx 3.4.1,当数据库的用户名或密码错误时,我的JDBC连接出现问题,vertx每次都尝试重新连接,这会导致数据库阻塞用户compte 这是给我提供数据库客户端的个人方法:Java Vertx,通过JDBC客户端连接到数据库阻塞,java,vert.x,Java,Vert.x,我使用的是vertx 3.4.1,当数据库的用户名或密码错误时,我的JDBC连接出现问题,vertx每次都尝试重新连接,这会导致数据库阻塞用户compte 这是给我提供数据库客户端的个人方法: public void getConnection(Handler<AsyncResult<SQLConnection>> resultHandler){ if(this.client == null){ logger.error(Error
public void getConnection(Handler<AsyncResult<SQLConnection>> resultHandler){
if(this.client == null){
logger.error(Error.BD_CLIENT_NOT_FOUND);
resultHandler.handle(Future.failedFuture(Error.BD_CLIENT_NOT_FOUND.toString()));
}else {
this.client.getConnection(connection -> {
if (connection.succeeded()) {
resultHandler.handle(Future.succeededFuture(connection.result()));
} else {
logger.error(connection.cause().getMessage());
resultHandler.handle(Future.failedFuture(Error.ER_DB_CONX.toString()));
}
});
}
}
public void getConnection(处理程序resultHandler){
if(this.client==null){
logger.error(找不到错误BD\u CLIENT\u);
resultHandler.handle(Future.failedFuture(Error.BD_CLIENT_NOT_FOUND.toString());
}否则{
this.client.getConnection(连接->{
if(connection.successed()){
句柄(Future.succeededFuture(connection.result());
}否则{
logger.error(connection.cause().getMessage());
handler.handle(Future.failedFuture(Error.ER_DB_CONX.toString());
}
});
}
}
你能帮我吗?谢谢为什么不试试
client.close()代码>请发布您的代码。为什么不试试client.close()代码>请发布您的代码。