Change the socket timeout of a live connection?

From: Matt Solnit <msolnit(at)soasta(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Change the socket timeout of a live connection?
Date: 2010-05-18 23:49:03
Message-ID: 9ED1C42C-8758-4052-822E-65C48BC3E20F@soasta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi everyone. Is there any way to change the socket timeout of an existing PostgreSQL JDBC connection? The reason I ask is that we would like to test various timeouts in a JBoss environment where we can't directly edit the JBoss data source XML file (and therefore the JDBC URL). So it would be great if we could somehow do this in Java code.

Based on a look at the source code, I'm pretty sure the answer is no -- we would have to have a way of getting to the PGStream.getSocket() method. And I'm not even sure what happens if you call setSoTimeout() more than once on an existing socket. But I thought I would ask anyway.

I'm using driver version 8.4-701 (JDBC 3), JRE 1.6.0_18 64-bit on Windows, connecting to a PostgreSQL 8.3 server on Linux.

-- Matt

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2010-05-19 00:00:21 Re: JDBC Driver and timezones
Previous Message Thomas Kellerer 2010-05-18 22:01:29 Re: JDBC Driver and timezones