Selects the Database Dialect based on the JDBC connection URL.

@param url the JDBC Connection URL
@return the dialect that maps to a specific JDBC URL.
977548
public static Dialect getDialect(String url){
        if(url.startsWith("jdbc:mysql:")){
            return new MySQLDialect();
        } else if(url.startsWith("jdbc:postgresql:")){
            return new PostgreSQLDialect();
        } else if(url.startsWith("jdbc:oracle:")){
            return new OracleDialect();
        } else if(url.startsWith("jdbc:hsqldb:")){
            return new HyperSQLDialect();
        } else if(url.startsWith("jdbc:h2:")){
            return new H2Dialect();
        } else if(url.startsWith("jdbc:derby:")){
            return new DerbyDialect();
        } else if(url.startsWith("jdbc:sqlite:")){
            return new SQLiteDialect();
        } else if(url.startsWith("jdbc:sqlserver:") || url.startsWith("jdbc:jtds:sqlserver:")){
            return new SQLServerDialect();
        } else if(url.startsWith("jdbc:db2:") || url.startsWith("jdbc:db2j:")
                || url.startsWith("jdbc:db2:ids") || url.startsWith("jdbc:informix-sqli:")
                || url.startsWith("jdbc:as400:")){
            return new DB2Dialect();
        }
        return new StandardDialect();
    }
1077152
public void setUrl(String url) {

    Properties p = org.postgresql.Driver.parseURL(url, null);

    if (p == null) {
      throw new IllegalArgumentException("URL invalid " + url);
    }
    for (PGProperty property : PGProperty.values()) {
      if (!this.properties.containsKey(property.getName())) {
        setProperty(property, property.get(p));
      }
    }
  }
1014450
@Pure
	@Inline(value = "URISchemeType.JAR.isURL($1)", imported = {URISchemeType.class})
	public static boolean isJarURL(URL url) {
		return URISchemeType.JAR.isURL(url);
	}
239761
public static UrlParser parse(final String url, Properties prop) throws SQLException {
    if (url != null
        && (url.startsWith("jdbc:mariadb:") || url.startsWith("jdbc:mysql:") && !url
        .contains(DISABLE_MYSQL_URL))) {
      UrlParser urlParser = new UrlParser();
      parseInternal(urlParser, url, (prop == null) ? new Properties() : prop);
      return urlParser;
    }
    return null;
  }
1198176
@Nullable
	private static String retrieveRemoteVersion(@Nonnull final URL url, @Nonnull final Charset charset) throws IOException {
		final InputStream stream = url.openStream();
		final InputStreamReader reader = new InputStreamReader(stream, charset);
		final LineNumberReader lnr = new LineNumberReader(reader);
		final String line = lnr.readLine();
		lnr.close();
		reader.close();
		stream.close();
		return line;
	}
748631
private static Connection getConnection(
        String url, java.util.Properties info, ClassLoader callerCL) throws SQLException {
        /*
         * When callerCl is null, we should check the application's
         * (which is invoking this class indirectly)
         * classloader, so that the JDBC driver class outside rt.jar
         * can be loaded from here.
         */
        synchronized (DriverManager.class) {
            // synchronize loading of the correct classloader.
            if (callerCL == null) {
                callerCL = Thread.currentThread().getContextClassLoader();
            }
        }

        if(url == null) {
            throw new SQLException("The url cannot be null", "08001");
        }

        println("DriverManager.getConnection(\"" + url + "\")");

        // Walk through the loaded registeredDrivers attempting to make a connection.
        // Remember the first exception that gets raised so we can reraise it.
        SQLException reason = null;

        for(DriverInfo aDriver : registeredDrivers) {
            // If the caller does not have permission to load the driver then
            // skip it.
            if(isDriverAllowed(aDriver.driver, callerCL)) {
                try {
                    println("    trying " + aDriver.driver.getClass().getName());
                    Connection con = aDriver.driver.connect(url, info);
                    if (con != null) {
                        // Success!
                        println("getConnection returning " + aDriver.driver.getClass().getName());
                        return (con);
                    }
                } catch (SQLException ex) {
                    if (reason == null) {
                        reason = ex;
                    }
                }

            } else {
                println("    skipping: " + aDriver.getClass().getName());
            }

        }

        // if we got here nobody could connect.
        if (reason != null)    {
            println("getConnection failed: " + reason);
            throw reason;
        }

        println("getConnection: no suitable driver found for "+ url);
        throw new SQLException("No suitable driver found for "+ url, "08001");
    }
1173538
public void setURL(int parameterIndex, java.net.URL x) {
        record(parameterIndex, getDeclaredMethod(PreparedStatement.class, "setURL", int.class, URL.class), parameterIndex, x);
    }
991558
@Override
    public boolean acceptsURL(String url) throws SQLException {

        if(url.startsWith(sqldroidPrefix) || url.startsWith(xerialPrefix)) {
            return true;
        }

        return false;
    }
1295627
public List<URL> getURLS(String html, URL url) {

	List<URL> urls = new ArrayList<URL>();
	SourceCode cfml = new SourceCode(html, false, CFMLEngine.DIALECT_CFML);
	while (!cfml.isAfterLast()) {
	    if (cfml.forwardIfCurrent('<')) {
		for (int i = 0; i < tags.length; i++) {
		    if (cfml.forwardIfCurrent(tags[i].tag + " ")) {
			getSingleUrl(urls, cfml, tags[i], url);
		    }
		}
	    }
	    else {
		cfml.next();
	    }
	}
	return urls;
    }
1107775
public static String encodeQuery(String url, String charset) throws UtilException {
		return encodeQuery(url, StrUtil.isBlank(charset) ? CharsetUtil.defaultCharset() : CharsetUtil.charset(charset));
	}
788056
public static URL getUrl(String url) {
    try {
      return new URL(url);
    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    }
  }
1148934
public static MavenPluginGeneratedConfigOption mavenConfiguration( String url )
    {
        validateNotEmpty( url, "specified configuration url must not be empty " );
        try
        {
            return mavenConfiguration( new URL( url ) );
        } catch( MalformedURLException mE )
        {
            throw new IllegalArgumentException( "url " + url + " is not a valid url", mE );
        }
    }
1005915
public static void setDbType(JdbcDialect dialect, String key, String type) {
        Properties props = getTypesProps(dialect);
        props.setProperty(key, type);
    }
1106654
public static String getHostFromURL(String url) {
		URL u = toURL(url);
		String host = (u == null) ? "" : u.getHost();
		return host;
	}
1313299
public static DataSource createDataSource(String url) throws SQLException {
        assertNotNull(url);

        BasicDataSource ds = new BasicDataSource();
        ds.setUrl(url);

        return ds;
    }
36162
public static Protos.CommandInfo.URI uri(URL url, boolean cacheable) {
		checkNotNull(url);
		return Protos.CommandInfo.URI.newBuilder()
			.setValue(url.toExternalForm())
			.setExtract(false)
			.setCache(cacheable)
			.build();
	}
841612
protected String getDBManipulationUrl()
    {
        JdbcConnectionDescriptor jcd = getConnection();

        return jcd.getProtocol()+":"+jcd.getSubProtocol()+":"+jcd.getDbAlias();
    }