From c602e4115823a8a3769d9feb0700f3857014f21f Mon Sep 17 00:00:00 2001 From: junjun Date: Wed, 5 Nov 2025 16:33:11 +0800 Subject: [PATCH] feat: add oracle instant client to support oracle version 11 --- backend/apps/db/db.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/backend/apps/db/db.py b/backend/apps/db/db.py index 85b28147..74d2e6b1 100644 --- a/backend/apps/db/db.py +++ b/backend/apps/db/db.py @@ -1,5 +1,6 @@ import base64 import json +import os import platform import urllib.parse from decimal import Decimal @@ -32,12 +33,15 @@ from common.core.config import settings try: - oracledb.init_oracle_client( - lib_dir=settings.ORACLE_CLIENT_PATH - ) - SQLBotLogUtil.info("init oracle client success, use thick mode") -except Exception: - SQLBotLogUtil.error("init oracle client failed, use thin mode") + if os.path.exists(settings.ORACLE_CLIENT_PATH): + oracledb.init_oracle_client( + lib_dir=settings.ORACLE_CLIENT_PATH + ) + SQLBotLogUtil.info("init oracle client success, use thick mode") + else: + SQLBotLogUtil.info("init oracle client failed, because not found oracle client, use thin mode") +except Exception as e: + SQLBotLogUtil.error("init oracle client failed, check your client is installed, use thin mode") def get_uri(ds: CoreDatasource) -> str: