amazon-archives / sql-jdbc

🔍 Open Distro for Elasticsearch JDBC Driver
Apache License 2.0
111 stars 49 forks source link

Cursor integration #76

Closed abbashus closed 4 years ago

abbashus commented 4 years ago

Issue: #74

Description of changes: This change is a part of the cursor support for JDBC driver to use new paginated response.

Usage:

      String url = "jdbc:elasticsearch://localhost:9200?";
      ...
      Connection con = DriverManager.getConnection(url);
Example 1:

        Properties properties = new Properties();
        properties.setProperty("fetchSize", "300");
        Connection con = DriverManager.getConnection(url, properties );

Example 2:

        InputStream input = new FileInputStream("path/to/config.properties")
        Properties properties = new Properties();
        properties.load(input);
        Connection con = DriverManager.getConnection(url, properties);
        Connection con = DriverManager.getConnection(url );
        Statement st = con.createStatement();
        st.setFetchSize(500);

When fetchSize is set in mutliple places, the final fetchSize value used is picked based on the following order of precedence:

Statement.setFetchSize() > Properties > Connection String

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.