'Postgres statement_timeout with No results were returned by the query

I have a query that I'm trying to execute via a PreparedStatement:

SET local statement_timeout TO 10000 ; SELECT 'x', pg_sleep(5);

When I run this via PGAdmin, the query will execute and there are no issues.

When I run this via a PreparedStatement in JDBC I get: org.postgresql.util.PSQLException: No results were returned by the query.

Anyone have an idea how to resolve this or if I am doing something incorrectly?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source