Skip to content

SQL: JDBC timeout properties are parsed in ms instead of seconds #79480

@Luegg

Description

@Luegg

The documentation for the ES JDBC driver states that all timeout system properties (like query.timeout) are parsed as seconds. This is currently not the case.

E.g. the following program

public class Main {
    public static void main(String[] args) {
        Properties props = new Properties();
        props.put("query.timeout", "10");
        props.put("page.timeout", "20");
        props.put("binary.format", "false");

        try (Connection conn = DriverManager.getConnection("jdbc:es://localhost:9202/", props);
             Statement stmt = conn.createStatement();
             ResultSet rs = stmt.executeQuery("SELECT 1");) {
            rs.next();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}

triggers a request with the body

    {
        "binary_format": false,
        "columnar": false,
        "field_multi_value_leniency": true,
        "keep_alive": "5d",
        "mode": "jdbc",
        "page_timeout": "10ms",
        "query": "SELECT 1",
        "request_timeout": "20ms",
        "time_zone": "Europe/Zurich",
        "version": "7.14.0"
    }

The same issue probably applies to the other timeout properties.

Also, the properties are treated as ms when read from the connection URL as in jdbc:es://localhost:9202/?query.timeout=10.

If the queryTimeout is set with Statement.setQueryTimeout it is interpreted in seconds as expected by the JDBC specs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions