JDBC Statement.setQueryTimeout : is there plan to implement this?

From: Sylvain Mougenot <smougenot(at)sqli(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: JDBC Statement.setQueryTimeout : is there plan to implement this?
Date: 2011-12-14 13:29:39
Message-ID: CACKdPFjK_UsZ5wExD-RvBbvi6Zo-VYtoxQsCUpWXzTN9kywj7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-sql

Query timeout is not supported in JDBC (driver version 9.1-901.jdbc4)
Statement.setQueryTimeout(int seconds) throws an exception when seconds > 0.
(in drivers prior to 8.3 there was no error but it was ignored)

Using Java + transaction management, we are missing this feature badly.
I found people trying to fallback using "SELECT statement_timeout(SEC)".
But this is useless in many cases (I mean transaction manager does it's
work independently) :
- my code do not directly decides to start a transaction
- some code may have different transaction settings
So I couldn't easily introduce the good select statement at the right
moment.

Even if the behaviour is not implemented, I guess it could be "mocked" if
the call to Statement.setQueryTimeout(int seconds) generated the select
statement "SELECT statement_timeout(SEC)".
I know this is not ideal but could solve the problem temporarily.
I could even be turned on by some driver settings.

--
Sylvain Mougenot

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2011-12-14 13:42:14 Re: JDBC Statement.setQueryTimeout : is there plan to implement this?
Previous Message Craig Ringer 2011-12-14 10:25:12 Re: configure same pg_hba.conf file for both ipv4 and ipv6 network

Browse pgsql-sql by date

  From Date Subject
Next Message Craig Ringer 2011-12-14 13:42:14 Re: JDBC Statement.setQueryTimeout : is there plan to implement this?
Previous Message Misa Simic 2011-12-12 09:36:24 Re: Subselects to Joins? Or: how to design phone calls database