/** * Get dburl which content are replaced by parameter value.(note: for mssql, this method result is * wrong, so i deprecated this method) * * @param dbType * @param host * @param port * @param dbName * @param dataSource * @param paramString TODO * @return * @deprecated use {@link #getDBUrl(String dbType, String Version, String host, String username, * String password, String port, String dbName, String dataSource, String paramString)} */ @Deprecated public String getDBUrl( String dbType, String host, String port, String dbName, String dataSource, String paramString) { String propUrlValue = PROP.getProperty(dbType); SupportDBUrlType defaultUrlType = supportDBUrlMap.get(dbType); // defaultUrlType = defaultUrlType == null ? SupportDBUrlType.ODBCDEFAULTURL : defaultUrlType; defaultUrlType = defaultUrlType == null ? SupportDBUrlType.MYSQLDEFAULTURL : defaultUrlType; if (propUrlValue == null) { return PluginConstant.EMPTY_STRING; } String argHost = (host == null) ? PluginConstant.EMPTY_STRING : host; String argPort = (port == null) ? PluginConstant.EMPTY_STRING : port; String argDBName = (dbName == null) ? PluginConstant.EMPTY_STRING : dbName; String argDataSource = (dataSource == null) ? PluginConstant.EMPTY_STRING : dataSource; Object[] argsUrl = {argHost, argPort, argDBName, argDataSource}; if (paramString.equals(PluginConstant.EMPTY_STRING)) { return MessageFormat.format(propUrlValue, argsUrl); } else { return MessageFormat.format(propUrlValue, argsUrl) + defaultUrlType.getParamSeprator() + paramString; } }
public String getDBUrl(SupportDBUrlType dbType) { return getDBUrl( dbType.getDBKey(), dbType.getHostName(), dbType.getPort(), dbType.getDBName(), dbType.getDataSource(), dbType.getParamSeprator() != null ? PluginConstant.DEFAULT_PARAMETERS : PluginConstant.EMPTY_STRING); }