Skip to main content
Question

Vertica JDBC driver and setQueryTimeout

  • December 28, 2022
  • 5 replies
  • 16 views

alehb

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.

5 replies

SruthiA
Forum|alt.badge.img+1
  • Participating Frequently
  • December 29, 2022

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?


alehb
  • Author
  • New Participant
  • February 12, 2023

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


alehb
  • Author
  • New Participant
  • February 12, 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


SruthiA
Forum|alt.badge.img+1
  • Participating Frequently
  • February 13, 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/


Sergey_Cherepan_1
Forum|alt.badge.img+2

You can execute SQL command in JDBC session:

Set session runtimecap ‘1 sec’

That would work independent of JDBC driver functionality.