0

In Mybatis there is an attribute timeout for mapper files but that throws Exception.

Cause: org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is not yet implemented.
uncategorized SQLException for SQL []; SQL state [0A000]; error code [0]; Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is not yet implemented.; nested exception is org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is not yet implemented.
........
0

1 Answer 1

1

PostgreSQL doesn't currently support query timeouts at the server level. So PgJDBC has a hard time implementing them client-side, though I rather thought current PgJDBC versions emulated it using statement_timeout.

Anyway, if updating to the latest PgJDBC (you failed to specify your version) doesn't help, what you need to do is SET statement_timeout before your query, then reset it after the query. Just execute:

SET statement_timeout = '5s';

or whatever before your query. If you're running it within an already open transaction you can use SET LOCAL to make the setting transaction scoped.

Sign up to request clarification or add additional context in comments.

2 Comments

Craig, I am using Postgrs 9.2 and using mapped xml for insert queries as <insert id="someId" parameterType="List">INSERT INTO Something () </insert>
@user1450574 Well, then you're going to have to use a more flexible framework, or (if the latest PgJDBC does not help) propose a patch to PgJDBC to do what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.