Thread: reconnecting to DB after connection break
Hello, I'm thinking of changing pgAdmin so it would try to reconnect after its connection to server breaks. Is that ok with you? Maybe theres someone already dealing with the problem. I think I could change pgConn::ExecuteVoid, pgConn::ExecuteScalar and pgConn::ExecuteSet methods so on connection to DB error there would be an attempt to reconnect. If someone knows a better solution - please, share it. :) I'm new here so maybe someone would advice what "pitfalls" to avoid. -- Julius Tuskenis
> -----Original Message----- > From: pgadmin-hackers-owner@postgresql.org [mailto:pgadmin-hackers- > owner@postgresql.org] On Behalf Of Julius Tuskenis > Sent: Friday, August 21, 2009 3:16 AM > To: pgadmin-hackers@postgresql.org > Subject: [pgadmin-hackers] reconnecting to DB after connection break > > Hello, > > I'm thinking of changing pgAdmin so it would try to reconnect after its > connection to server breaks. Is that ok with you? Maybe theres someone > already dealing with the problem. > > I think I could change pgConn::ExecuteVoid, pgConn::ExecuteScalar and > pgConn::ExecuteSet methods so on connection to DB error there would be > an attempt to reconnect. If someone knows a better solution - please, > share it. :) > > I'm new here so maybe someone would advice what "pitfalls" to avoid. > > -- > Julius Tuskenis > Sounds like a good idea. The one pitfall I see is that any temporary tables the session had disappear when you disconnectand reconnect, but I don't think there is anything to be done about that.
Le vendredi 21 août 2009 à 22:05:42, Chuck McDevitt a écrit : > > -----Original Message----- > > From: pgadmin-hackers-owner@postgresql.org [mailto:pgadmin-hackers- > > owner@postgresql.org] On Behalf Of Julius Tuskenis > > Sent: Friday, August 21, 2009 3:16 AM > > To: pgadmin-hackers@postgresql.org > > Subject: [pgadmin-hackers] reconnecting to DB after connection break > > > > Hello, > > > > I'm thinking of changing pgAdmin so it would try to reconnect after its > > connection to server breaks. Is that ok with you? Maybe theres someone > > already dealing with the problem. > > > > I think I could change pgConn::ExecuteVoid, pgConn::ExecuteScalar and > > pgConn::ExecuteSet methods so on connection to DB error there would be > > an attempt to reconnect. If someone knows a better solution - please, > > share it. :) > > > > I'm new here so maybe someone would advice what "pitfalls" to avoid. > > > > -- > > Julius Tuskenis > > Sounds like a good idea. The one pitfall I see is that any temporary > tables the session had disappear when you disconnect and reconnect, but I > don't think there is anything to be done about that. You're right. There's also no way to continue the previous transaction. Anyways, lots of people are asking for this feature. -- Guillaume. http://www.postgresqlfr.org http://dalibo.com
On Fri, Aug 21, 2009 at 11:16 AM, Julius Tuskenis<julius.tuskenis@gmail.com> wrote: > Hello, > > I'm thinking of changing pgAdmin so it would try to reconnect after its > connection to server breaks. Is that ok with you? Maybe theres someone > already dealing with the problem. It's a TODO, but I don't think anyone is working on it. > I think I could change pgConn::ExecuteVoid, pgConn::ExecuteScalar and > pgConn::ExecuteSet methods so on connection to DB error there would be an > attempt to reconnect. If someone knows a better solution - please, share it. > :) That probably isn't the place to do it though - at least without other work. If it's done at that low level, you a) need to find a clean way of communicating to the user what is going on, from non-UI code, and b) need to ensure that all the different parts of the code (browser, query tool, debugger, edit grid etc) will behave sanely if presented with a connection that's been reconnected automatically. It would probably be easier to handle the reconnection in those places instead, where you can more easily determine what is or isn't an appropriate action in the face of a lost connection. -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com