prestodb/presto · error · SQLException

Connection property '%s' is both in the URL and an argument

Error message

Connection property '%s' is both in the URL and an argument

What it means

mergeConnectionProperties rejects a JDBC URL that specifies the same connection property both as a URL query parameter and as an entry in the driver Properties argument. This is a conflict guard: Presto cannot decide which value wins, so the URI is rejected before a connection is attempted.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDriverUri.java:434

        if (parts.size() > 1) {
            if (parts.get(1).isEmpty()) {
                throw new SQLException("Schema name is empty: " + uri);
            }
            schema = parts.get(1);
        }
    }

    private static Properties mergeConnectionProperties(URI uri, Properties driverProperties)
            throws SQLException
    {
        Map<String, String> defaults = ConnectionProperties.getDefaults();
        Map<String, String> urlProperties = parseParameters(uri.getQuery());
        Map<String, String> suppliedProperties = Maps.fromProperties(driverProperties);

        for (String key : urlProperties.keySet()) {
            if (suppliedProperties.containsKey(key)) {
                throw new SQLException(format("Connection property '%s' is both in the URL and an argument", key));
            }
        }

        Properties result = new Properties();
        setProperties(result, defaults);
        setProperties(result, urlProperties);
        setProperties(result, suppliedProperties);
        return result;
    }

    private static void setProperties(Properties properties, Map<String, String> values)
    {
        for (Entry<String, String> entry : values.entrySet()) {
            properties.setProperty(entry.getKey(), entry.getValue());
        }
    }

    private static void validateConnectionProperties(Properties connectionProperties)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Remove the duplicate property from either the JDBC URL or the Properties object so each key appears in only one place
  2. Compare the URL parameters (parseParameters(uri.getQuery())) with the supplied Properties to find the overlapping keys
  3. Adopt one source of truth for configuration, e.g. pass all properties via the URL, and document the precedence for other users
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDriverUri.java:434 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/d873f309a55ac264. Report an issue: GitHub.