This commit is contained in:
QAIU
2023-05-12 17:30:10 +08:00
parent bada4d7e4a
commit 9c236d0663
5 changed files with 100 additions and 8 deletions

View File

@@ -88,7 +88,14 @@ public class JDBCPoolInit {
}
private void poolInitExecute(Promise<String> promise) {
// 初始化H2db, 创建本地db文件
// 初始化连接池
pool = JDBCPool.pool(vertx, dbConfig);
CreateTable.createTable(pool, dbConfig.getString("tableClassPath"));
promise.complete("init jdbc pool success");
}
private void checkOrCreateDBFile() {
LOGGER.info("init sql start");
String[] path = url.split("\\./");
path[1] = path[1].split(";")[0];
@@ -109,14 +116,12 @@ public class JDBCPoolInit {
throw new RuntimeException("file create failed");
}
}
// 初始化连接池
pool = JDBCPool.pool(vertx, dbConfig);
CreateTable.createTable(pool, dbConfig.getString("tableClassPath"));
promise.complete("init jdbc pool success");
}
private void h2serverExecute(Promise<String> promise) {
// 初始化H2db, 创建本地db文件
checkOrCreateDBFile();
try {
String url = dbConfig.getString("jdbcUrl");
String[] portStr = url.split(":");