|
|
|
@ -49,7 +49,17 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT
|
|
|
|
|
|
|
|
|
|
export function resolveUrlInfo (url: string) { |
|
|
|
|
if (BI.isNull(url)) return {}; |
|
|
|
|
const greenplumUrl = url.match(/^jdbc:(pivotal:greenplum):(thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/|;)([^]+)(.*)/i); |
|
|
|
|
const oracleUlr = url.match(/^jdbc:(oracle):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:)([^]+)(.*)/i); |
|
|
|
|
if (oracleUlr) { |
|
|
|
|
return { |
|
|
|
|
host: oracleUlr[5], |
|
|
|
|
port: oracleUlr[7] === 'port' ? '' : oracleUlr[7], |
|
|
|
|
databaseName: oracleUlr[9], |
|
|
|
|
urlInfo: oracleUlr[10], |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const greenplumUrl = url.match(/^jdbc:(pivotal:greenplum):(thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;)([^]+)(.*)/i); |
|
|
|
|
if (greenplumUrl) { |
|
|
|
|
return { |
|
|
|
|
host: greenplumUrl[4], |
|
|
|
@ -58,12 +68,12 @@ export function resolveUrlInfo (url: string) {
|
|
|
|
|
urlInfo: greenplumUrl[9], |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
const result = url.match(/^jdbc:(oracle|mysql|sqlserver|db2|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/|;DatabaseName=)([^]+)(.*)/i); |
|
|
|
|
const result = url.match(/^jdbc:(mysql|sqlserver|db2|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;DatabaseName=)?([^]+)?(.*)/i); |
|
|
|
|
if (result) { |
|
|
|
|
return { |
|
|
|
|
host: result[5], |
|
|
|
|
port: result[7] === 'port' ? '' : result[7], |
|
|
|
|
databaseName: result[9], |
|
|
|
|
databaseName: result[9] || '', |
|
|
|
|
urlInfo: result[10], |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|