summaryrefslogtreecommitdiff
path: root/lib/oracle-db/check.ts
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-07-01 10:44:02 +0000
committerjoonhoekim <26rote@gmail.com>2025-07-01 10:44:02 +0000
commit6e25ab8da8a90a6d9bf40ccc83e36f119fb27568 (patch)
treef608ec6315b845b5770c2a357c6540116145cb41 /lib/oracle-db/check.ts
parentaf52dbc2b96e619be18dea857ea67d99622092a7 (diff)
(김준회) 비활성화한 node-cron 진입점 (instrumentation.ts) 추가 및 NONSAP 동기화 개발건
Diffstat (limited to 'lib/oracle-db/check.ts')
-rw-r--r--lib/oracle-db/check.ts39
1 files changed, 39 insertions, 0 deletions
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