Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use postgreSQL 9.2 as the database and Java 6 as the programming language.

There is no problem when I run my program on the server computer. But when I run my program from a remote client, oftentimes (not always) when I run a query, the program on the client side hangs and the network connection goes RTO (I ping the connection with -t).

There is no exception thrown by the program, it just hangs. But when the program doesn't run any query, the network connection's just fine. There is no RTO.

The connection from client to server goes through 2 hub. It is connected because sometimes the program runs fine. No firewall on both computers.

Has anyone else had this problem before? How do I handle this, there is no timeout exception. Nothing.

share|improve this question

migrated from Apr 4 '13 at 9:35

This question came from our site for professional and enthusiast programmers.

Define "RTO". "Request Timed Out"? Google isn't particularly helpful. Other basic details you need to supply include: Server operating system and version,client OS and version, how client and server are connected, is there NAT between client and server, does client and/or server run a software firewall and your PostgreSQL version. Please edit your question with details including exact text of error messages or full text of exceptions and comment here when done. – Craig Ringer Apr 3 '13 at 6:59
Details added.. – William Apr 3 '13 at 7:28
Still doesn't make sense. You say you get "RTO" but there's no exception. Is the timeout from ping? Show the ping output if so. So far this sounds like a dodgy network that's dropping packets randomly. – Craig Ringer Apr 3 '13 at 7:32
The connection to that server is somehow unstable. Probably I should've asked how to deal with timeout in java database connection, the problem is there isn't even an exception thrown by the connection manager, it just hangs. – William Apr 4 '13 at 4:59
You will need to set a tcp keepalive to detect the connection loss. – Craig Ringer Apr 4 '13 at 5:02

You must log in to answer this question.

Browse other questions tagged .