How to configure a JDBC Query Timeout for PostgreSQL?

Solution Unverified - Updated -

Issue

  • I would like to configure the query timeout for PostgreSQL. How do I configure the timeout?
  • I tried the following setting to the datasource configuration in JBoss EAP but it does not work.

        <query-timeout>60</query-timeout>
    
  • I saw the following Exception when I called Statement.setQueryTimeout(int):

    org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is not yet implemented.
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 4.x
    • 5.x
    • 6.x
  • PostgreSQL JDBC Driver
    • 8.x
    • 9.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.