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..90c41b8 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',