DbUrlUtil { public static String[] extractHostPort(@NotNull DbUrl url) { if (url instanceof JdbcDbUrl) { return new String[]{((JdbcDbUrl) url).getHost() + ":" + ((JdbcDbUrl) url).getPort()}; } else if (url instanceof TNSUrl) { final List<String> out = new ArrayList<String>(); NetServiceDesc netService = ((TNSUrl) url).getNetServiceDesc(); iterateOverAddress(netService, new HostPortAddressElemHandler() { public boolean handle(ASTNode hostNode, ASTNode portNode) { out.add(hostNode.getText() + ":" + (portNode != null ? portNode.getText() : "1521")); return true; } }); return out.toArray(new String[out.size()]); } return new String[0]; }  static DbUrl parse(String dbUrl); static String[] extractHostPort(@NotNull DbUrl url); static String serialize(TNSUrl url); static String serialize(DbUrl.SshSettings settings); static String serialize(DbUrlSID url); static String serialize(DbUrlServiceName url); static boolean equals(DbUrl.SshSettings set1, DbUrl.SshSettings set2); static DbUrl replaceHostPort(
            @NotNull DbUrl url, @NotNull final String template, @NotNull final String replacement);  }
@Test public void test_jdbc_extractHostPort(){ DbUrl url1 = new DbUrlServiceName("test", "test", "localhost", "1521", "ORA1"); Assert.assertEquals(1, DbUrlUtil.extractHostPort(url1).length); Assert.assertEquals("localhost:1521", DbUrlUtil.extractHostPort(url1)[0]); url1 = new DbUrlSID("test", "test", "127.0.0.1", "1521", "ORA1"); Assert.assertEquals(1, DbUrlUtil.extractHostPort(url1).length); Assert.assertEquals("127.0.0.1:1521", DbUrlUtil.extractHostPort(url1)[0]); }