From d127e8e25bba1afb4b4c0ddcbabba71a566d96e0 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Thu, 30 Nov 2023 11:41:36 +0800 Subject: [PATCH] =?UTF-8?q?FDL-9101=20fix:=20=E4=BF=AE=E5=A4=8Dsaphana?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=A4=B1=E8=B4=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 16 ++++++++++++++-- src/modules/constants/constant.ts | 7 ++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index d38fdc5..b236bb2 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -1,4 +1,10 @@ -import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE, OTHER_JDBC } from '@constants/constant'; +import { + DATA_BASE_TYPES, + DATA_BASE_TYPES_OTHER, + DESIGN_DRIVER_TYPE, + OTHER_JDBC, + DATABASE_TYPE, +} from '@constants/constant'; import { DatabaseType } from './app.typings'; import { Connection } from './crud/crud.typings'; export function getAllDatabaseTypes(): DatabaseType[] { @@ -75,7 +81,7 @@ export function splitUrl(host: string, port: string, catalog: string, database: .replace(':INFORMIXSERVER={server}', ''); } - if (databaseType === 'starrocks') { + if (databaseType === DATABASE_TYPE.STAR_ROCKS) { let databaseStr = ''; if (!catalog || !database) { databaseStr = catalog + database; @@ -86,6 +92,12 @@ export function splitUrl(host: string, port: string, catalog: string, database: .replace('default_catalog.database', databaseStr); } + if (databaseType === DATABASE_TYPE.SAP_HANA) { + return baseUrl.replace('hostname', host) + .replace('port', port || '') + .replace('=database', `=${database}`); + } + return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') .replace('/database', `/${database}`) .replace(':database', `:${database}`) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 2e12817..7733b95 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -5,6 +5,11 @@ export const PAGE_INDEX = { POOL: 'pool', }; +export const DATABASE_TYPE = { + SAP_HANA: "sap-hana", + STAR_ROCKS :'starrocks', +} + export const OTHER_JDBC = 'otherJDBC'; export const DEFAULT_HELP_LINK = 'databaseHelpLink'; @@ -609,7 +614,7 @@ export const DATA_BASE_TYPES = [ text: 'SAP HANA', databaseType: 'sap-hana', driver: 'com.sap.db.jdbc.Driver', - url: 'jdbc:sap://hostname:port?reconnect=true', + url: 'jdbc:sap://hostname:port?databaseName=database&reconnect=true', commonly: false, internal: true, type: 'jdbc',