Browse Source

FDL-9101 fix: 修复saphana数据连接失败问题

release/11.0
Austin.Duan 12 months ago
parent
commit
d127e8e25b
  1. 16
      src/modules/app.service.ts
  2. 7
      src/modules/constants/constant.ts

16
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 { DatabaseType } from './app.typings';
import { Connection } from './crud/crud.typings'; import { Connection } from './crud/crud.typings';
export function getAllDatabaseTypes(): DatabaseType[] { export function getAllDatabaseTypes(): DatabaseType[] {
@ -75,7 +81,7 @@ export function splitUrl(host: string, port: string, catalog: string, database:
.replace(':INFORMIXSERVER={server}', ''); .replace(':INFORMIXSERVER={server}', '');
} }
if (databaseType === 'starrocks') { if (databaseType === DATABASE_TYPE.STAR_ROCKS) {
let databaseStr = ''; let databaseStr = '';
if (!catalog || !database) { if (!catalog || !database) {
databaseStr = catalog + database; databaseStr = catalog + database;
@ -86,6 +92,12 @@ export function splitUrl(host: string, port: string, catalog: string, database:
.replace('default_catalog.database', databaseStr); .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}` : '') return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('/database', `/${database}`) .replace('/database', `/${database}`)
.replace(':database', `:${database}`) .replace(':database', `:${database}`)

7
src/modules/constants/constant.ts

@ -5,6 +5,11 @@ export const PAGE_INDEX = {
POOL: 'pool', POOL: 'pool',
}; };
export const DATABASE_TYPE = {
SAP_HANA: "sap-hana",
STAR_ROCKS :'starrocks',
}
export const OTHER_JDBC = 'otherJDBC'; export const OTHER_JDBC = 'otherJDBC';
export const DEFAULT_HELP_LINK = 'databaseHelpLink'; export const DEFAULT_HELP_LINK = 'databaseHelpLink';
@ -609,7 +614,7 @@ export const DATA_BASE_TYPES = [
text: 'SAP HANA', text: 'SAP HANA',
databaseType: 'sap-hana', databaseType: 'sap-hana',
driver: 'com.sap.db.jdbc.Driver', driver: 'com.sap.db.jdbc.Driver',
url: 'jdbc:sap://hostname:port?reconnect=true', url: 'jdbc:sap://hostname:port?databaseName=database&reconnect=true',
commonly: false, commonly: false,
internal: true, internal: true,
type: 'jdbc', type: 'jdbc',

Loading…
Cancel
Save