Vertica JDBC driver and setQueryTimeout

alehbalehb Vertica Customer
edited March 2023 in General Discussion

Hi.

We use com.vertica.jdbc.vertica-jdbc:12.0.2-0 and try to use setQueryTimeout method to set maximum query execution time. Looks like the driver does not take into account the specified timeout and the request continues to be executed longer than the specified time.
Are there any plans to implement this functionality?

Thanks.

Answers

  • SruthiASruthiA Vertica Employee Administrator

    could you please open a support case and share us with example query, scrutinize and screenshot from your JDBC tool showing that query is running longer than timeout you have set?

  • alehbalehb Vertica Customer

    Thanks for the answer. How I can open the support case?

  • alehbalehb Vertica Customer
    edited February 2023

    Here the code:

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;

    public class EP {

    public static void main(String[] args) throws SQLException {
        try (Connection connection = DriverManager.getConnection("jdbc:vertica://localhost:5433/database", "user", "password");) {
            try (Statement statement = connection.createStatement();) {
                statement.setQueryTimeout(1);
    
                long currentTimeMillis = System.currentTimeMillis();
                statement.execute("SELECT sleep(10)");
                System.err.println(System.currentTimeMillis() - currentTimeMillis);
            }
        }
    }
    

    }

    This query executes without timeout error in 10 seconds. We expect to get timeout error after 1 second of execution

  • SruthiASruthiA Vertica Employee Administrator
    edited February 2023

    @alehb : Thank you for sharing the code. It is a known issue and the bug is not fixed yet. If you need more information,

    Please open support case via https://sld.microfocus.com/

  • You can execute SQL command in JDBC session:

    Set session runtimecap ‘1 sec’

    That would work independent of JDBC driver functionality.

This discussion has been closed.