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: