From 6e25ab8da8a90a6d9bf40ccc83e36f119fb27568 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Tue, 1 Jul 2025 10:44:02 +0000 Subject: (김준회) 비활성화한 node-cron 진입점 (instrumentation.ts) 추가 및 NONSAP 동기화 개발건 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/oracle-db/check.ts | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/oracle-db/check.ts (limited to 'lib/oracle-db/check.ts') diff --git a/lib/oracle-db/check.ts b/lib/oracle-db/check.ts new file mode 100644 index 00000000..0b26bef4 --- /dev/null +++ b/lib/oracle-db/check.ts @@ -0,0 +1,39 @@ +// 연결을 테스트하는 함수 +import { getOracleConnection, oracleKnex } from './db'; + +export async function testOracleConnection() { + try { + const connection = await getOracleConnection(); + const result = await connection.execute('SELECT 1 FROM DUAL'); + await connection.close(); + return { + success: true, + message: 'Oracle DB 연결 성공', + data: result.rows + }; + } catch (error: unknown) { + return { + success: false, + message: 'Oracle DB 연결 실패', + error: error instanceof Error ? error.message : '알 수 없는 오류' + }; + } + } + + // Knex를 사용하여 Oracle 연결 테스트 + export async function testKnexOracleConnection() { + try { + const result = await oracleKnex.raw('SELECT 1 FROM DUAL'); + return { + success: true, + message: 'Knex Oracle DB 연결 성공', + data: result + }; + } catch (error: unknown) { + return { + success: false, + message: 'Knex Oracle DB 연결 실패', + error: error instanceof Error ? error.message : '알 수 없는 오류' + }; + } + } \ No newline at end of file -- cgit v1.2.3