Re: keep a connection alive

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization Providenza & Boekelheide, Inc.
Message-ID <[email protected]>
johnf wrote:
> I created a program that uses psycopg2 to connect remotely to a postgres 8.3.1  
> database (server is on a linux box).  On my local linux system I can keep the 
> connection forever.  However, on the clients XP windows it appears to timeout 
> during idle time.  It has been suggested that maybe the tcp_keepalives 
> options need to be set on the server.  Can someone here enlighten me 
> regarding how psycopg2 handles the problem on windows.  And what I might want 
> to do on the server side if anything.  The setting is at default (as it came 
> from openSUSE 11).
>   

I would think that a better long-term solution is for you to handle
these idle disconnects.  Perhaps you could close the connection before
going idle and re-open it afterward.  Or, perhaps something like the
"DBUtils" module might help.

-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.