The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.
Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

Vertica JDBC driver and setQueryTimeout

alehbalehb Vertica Customer
edited March 25 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 Employee

    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 12

    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 Employee
    edited February 13

    @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.