mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-08-03 06:17:03 +08:00
Fix oracle datatype error
This commit is contained in:
@ -0,0 +1,30 @@
|
||||
//package ai.chat2db.server.start.config;
|
||||
//
|
||||
//import jakarta.annotation.PostConstruct;
|
||||
//import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
//import org.springframework.context.ApplicationListener;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.util.Scanner;
|
||||
//
|
||||
//@Component
|
||||
//public class StdinReader implements ApplicationListener<ApplicationReadyEvent> {
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public void onApplicationEvent(ApplicationReadyEvent event) {
|
||||
// // 启动读取 stdin 的线程
|
||||
// new Thread(() -> readStdin()).start();
|
||||
// }
|
||||
//
|
||||
// private void readStdin() {
|
||||
// Scanner scanner = new Scanner(System.in);
|
||||
// while (scanner.hasNextLine()) {
|
||||
// String line = scanner.nextLine();
|
||||
// // 处理接收到的数据
|
||||
// System.out.println("接收到数据: " + line);
|
||||
// // 在这里调用其他服务或逻辑
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
@ -1,7 +1,7 @@
|
||||
spring:
|
||||
datasource:
|
||||
# 配置自带数据库的相对路径
|
||||
url: jdbc:h2:~/.chat2db/db/chat2db_dev;MODE=MYSQL
|
||||
url: jdbc:h2:~/.chat2db/db/chat2db_dev;MODE=MYSQL;FILE_LOCK=NO
|
||||
driver-class-name: org.h2.Driver
|
||||
h2:
|
||||
console:
|
||||
|
@ -73,19 +73,19 @@ public class RdbDdlController extends EmbeddingController {
|
||||
PageResult<Table> tableDTOPageResult = tableService.pageQuery(queryParam, tableSelector);
|
||||
List<TableVO> tableVOS = rdbWebConverter.tableDto2vo(tableDTOPageResult.getData());
|
||||
|
||||
ConnectInfo connectInfo = Chat2DBContext.getConnectInfo();
|
||||
singleThreadExecutor.submit(() -> {
|
||||
try {
|
||||
Chat2DBContext.putContext(connectInfo);
|
||||
syncTableVector(request);
|
||||
// syncTableEs(request);
|
||||
} catch (Exception e) {
|
||||
log.error("sync table vector error", e);
|
||||
} finally {
|
||||
Chat2DBContext.removeContext();
|
||||
}
|
||||
log.info("sync table vector finish");
|
||||
});
|
||||
// ConnectInfo connectInfo = Chat2DBContext.getConnectInfo();
|
||||
// singleThreadExecutor.submit(() -> {
|
||||
// try {
|
||||
// Chat2DBContext.putContext(connectInfo);
|
||||
// syncTableVector(request);
|
||||
//// syncTableEs(request);
|
||||
// } catch (Exception e) {
|
||||
// log.error("sync table vector error", e);
|
||||
// } finally {
|
||||
// Chat2DBContext.removeContext();
|
||||
// }
|
||||
// log.info("sync table vector finish");
|
||||
// });
|
||||
return WebPageResult.of(tableVOS, tableDTOPageResult.getTotal(), request.getPageNo(),
|
||||
request.getPageSize());
|
||||
}
|
||||
|
@ -64,19 +64,19 @@ public class TableController extends EmbeddingController {
|
||||
tableSelector.setIndexList(false);
|
||||
PageResult<Table> tableDTOPageResult = tableService.pageQuery(queryParam, tableSelector);
|
||||
List<TableVO> tableVOS = rdbWebConverter.tableDto2vo(tableDTOPageResult.getData());
|
||||
ConnectInfo connectInfo = Chat2DBContext.getConnectInfo();
|
||||
singleThreadExecutor.submit(() -> {
|
||||
try {
|
||||
Chat2DBContext.putContext(connectInfo);
|
||||
syncTableVector(request);
|
||||
// syncTableEs(request);
|
||||
} catch (Exception e) {
|
||||
log.error("sync table vector error", e);
|
||||
} finally {
|
||||
Chat2DBContext.removeContext();
|
||||
}
|
||||
log.info("sync table vector finish");
|
||||
});
|
||||
// ConnectInfo connectInfo = Chat2DBContext.getConnectInfo();
|
||||
// singleThreadExecutor.submit(() -> {
|
||||
// try {
|
||||
// Chat2DBContext.putContext(connectInfo);
|
||||
// syncTableVector(request);
|
||||
//// syncTableEs(request);
|
||||
// } catch (Exception e) {
|
||||
// log.error("sync table vector error", e);
|
||||
// } finally {
|
||||
// Chat2DBContext.removeContext();
|
||||
// }
|
||||
// log.info("sync table vector finish");
|
||||
// });
|
||||
return WebPageResult.of(tableVOS, tableDTOPageResult.getTotal(), request.getPageNo(),
|
||||
request.getPageSize());
|
||||
}
|
||||
|
@ -81,11 +81,15 @@ public class Chat2DBContext {
|
||||
if (connection == null) {
|
||||
synchronized (connectInfo) {
|
||||
connection = connectInfo.getConnection();
|
||||
if (connection != null) {
|
||||
try {
|
||||
if (connection != null && !connection.isClosed()) {
|
||||
return connection;
|
||||
} else {
|
||||
connection = getDBManage().getConnection(connectInfo);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
connection = getDBManage().getConnection(connectInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return connection;
|
||||
|
Reference in New Issue
Block a user