public static TsfileConnectionParams parseURL(String url, Properties info) throws TsfileURLException {
        TsfileConnectionParams params = new TsfileConnectionParams(url);
        if (url.trim().equalsIgnoreCase(TsfileJDBCConfig.TSFILE_URL_PREFIX)) {
            return params;
        }

        Pattern pattern = Pattern.compile("([^;]*):([^;]*)/");
        Matcher matcher = pattern.matcher(url.substring(TsfileJDBCConfig.TSFILE_URL_PREFIX.length()));
        boolean isUrlLegal = false;
        while (matcher.find()) {
            params.setHost(matcher.group(1));
            params.setPort(Integer.parseInt((matcher.group(2))));
            isUrlLegal = true;
        }
        if (!isUrlLegal) {
            throw new TsfileURLException("Error url format, url should be jdbc:tsfile://ip:port/");
        }

        if (info.containsKey(TsfileJDBCConfig.AUTH_USER)) {
            params.setUsername(info.getProperty(TsfileJDBCConfig.AUTH_USER));
        }
        if (info.containsKey(TsfileJDBCConfig.AUTH_PASSWORD)) {
            params.setPassword(info.getProperty(TsfileJDBCConfig.AUTH_PASSWORD));
        }

        return params;
    }
public static TsfileConnectionParams parseURL ( String url , Properties info ) throws TsfileURLException { TsfileConnectionParams params = new TsfileConnectionParams ( url ) ; if ( url . trim ( ) . equalsIgnoreCase ( TsfileJDBCConfig . TSFILE_URL_PREFIX ) ) { return params ; } Pattern pattern = Pattern . compile ( "([^;]*):([^;]*)/" ) ; Matcher matcher = pattern . matcher ( url . substring ( TsfileJDBCConfig . TSFILE_URL_PREFIX . length ( ) ) ) ; boolean isUrlLegal = false ; while ( matcher . find ( ) ) { params . setHost ( matcher . group ( 1 ) ) ; params . setPort ( Integer . parseInt ( ( matcher . group ( 2 ) ) ) ) ; isUrlLegal = true ; } if ( ! isUrlLegal ) { throw new TsfileURLException ( "Error url format, url should be jdbc:tsfile://ip:port/" ) ; } if ( info . containsKey ( TsfileJDBCConfig . AUTH_USER ) ) { params . setUsername ( info . getProperty ( TsfileJDBCConfig . AUTH_USER ) ) ; } if ( info . containsKey ( TsfileJDBCConfig . AUTH_PASSWORD ) ) { params . setPassword ( info . getProperty ( TsfileJDBCConfig . AUTH_PASSWORD ) ) ; } return params ; }
Parse JDBC connection URL The only supported format of the URL is:
jdbc:tsfile://localhost:6667/