我一直在尝试使用Vertx将SQL脚本模式加载到MySQL DB中。
尽管如此,我能够加载或更新任何单个DB命令,但无法一次性加载完整的模式。
面临的第二个挑战是,这可能会阻止Vertx应用程序的代码。如果是这样,如何避免呢?
下面是我一直试图执行的代码片段:
jdbcClient.getConnection(resConn -> {
if(resConn.succeeded()) {
SQLConnection connection = resConn.result();
connection.execute("<Trying to load the SQL Script schema>", resSchema -> {
connection.close();
if(resSchema.succeeded()) {
async.complete();
} else {
testContext.fail("Failed to load bootstrap schema: " + resSchema.cause().getMessage());
}
});
} else {
testContext.fail("Failed to obtain DB connection for schema write");
}
});