Testing a DB connection

Bob Sneidar bobs at twft.com
Wed May 26 13:31:53 CDT 2010


Yes just check the result after making a call to the DB. I have found it useful to set up my data before opening a connection to a database, and then once I open it, I update all my data and close it right away. This way I know I have to open a connection just before updating any data, and I usually have a command or function I call that exit's to top after popping a dialog for the user's sake. 

As others have posted, sqlYoga also has a method of reconnecting, but of course if the database is gone, it will still return an error, so you still have to handle it. 

Bob


On May 26, 2010, at 9:50 AM, Alex Adams wrote:

> Does anyone have a simple technique for testing to see if a DB connection is
> still functioning before trying to use it to execute some SQL?
> 
> I have an app that accesses hosted databases directly (postgres).  Users
> logon at app startup.  If they let the app sit for long enough, the
> connection to the DB server is dropped.  This is reasonable, but I want a
> simple way of testing to see if the connection has been dropped and if it
> has to reestablish the connection transparently before executing SQL
> statements.
> 
> I need a simple isDBStillThere handler.  Is anyone doing anything similar?
> 
> Thanks,
> -- 
> Alex Adams
> 
> hawkVision — tools for solving Wicked Problems
> 
> (a)2 Technology Partners, Inc.
> 831-726-8013
> alex at a2technology.com
> hawkVisionInfo.wordpress.com
> universalConnector.wordpress.com
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list