Skip to content

Commit 97400e3

Browse files
committed
feat: add oracle instant client to support oracle version 11
1 parent 33058ea commit 97400e3

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

backend/apps/db/db.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import base64
22
import json
3+
import os
34
import platform
45
import urllib.parse
56
from decimal import Decimal
@@ -32,12 +33,15 @@
3233
from common.core.config import settings
3334

3435
try:
35-
oracledb.init_oracle_client(
36-
lib_dir=settings.ORACLE_CLIENT_PATH
37-
)
38-
SQLBotLogUtil.info("init oracle client success, use thick mode")
39-
except Exception:
40-
SQLBotLogUtil.error("init oracle client failed, use thin mode")
36+
if os.path.exists(settings.ORACLE_CLIENT_PATH):
37+
oracledb.init_oracle_client(
38+
lib_dir=settings.ORACLE_CLIENT_PATH
39+
)
40+
SQLBotLogUtil.info("init oracle client success, use thick mode")
41+
else:
42+
SQLBotLogUtil.info("init oracle client failed, because not found oracle client, use thin mode")
43+
except Exception as e:
44+
SQLBotLogUtil.error("init oracle client failed, check your client is installed, use thin mode")
4145

4246

4347
def get_uri(ds: CoreDatasource) -> str:

0 commit comments

Comments
 (0)