diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index 4f508b8..d919bf7 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -45,7 +45,7 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT export function resolveUrlInfo (url: string) { if (BI.isNull(url)) return {}; - const result = url.match(/^jdbc:(oracle|mysql|sqlserver|db2|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9]+))?(:|\/|;DatabaseName=)([0-9a-zA-Z_\\.]+)(.*)/i); + const result = url.match(/^jdbc:(oracle|mysql|sqlserver|db2|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/|;DatabaseName=)([0-9a-zA-Z_\\.]+)(.*)/i); if (result) { return { host: result[5], diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 43b42b2..ab14cb5 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -7,6 +7,7 @@ import { connectionType } from '@constants/env'; import { ConnectionJDBC, Connection } from 'src/modules/crud/crud.typings'; import { TestStatusXtype, EVENT_RELOAD, EVENT_CLOSE } from 'src/modules/components/test_status/test_status'; import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL } from '@constants/constant'; +import { getJdbcDatabaseType } from 'src/modules/app.service'; export const MaintainFormXtype = 'dec.dcm.maintain.form'; @shortcut(MaintainFormXtype) @@ -164,8 +165,11 @@ export class MaintainForm extends BI.Widget { } this.isEdit = true; this.connectionName = this.model.connectionSelectedOne.connectionName; + const connection = BI.clone(this.model.connectionSelectedOne); + const { database, driver } = connection.connectionData as ConnectionJDBC; + (connection.connectionData as ConnectionJDBC).database = getJdbcDatabaseType(database, driver).databaseType; - return this.model.connectionSelectedOne; + return connection; } private getJndiConnection():Connection {