ODBC access (closing connections)

Roger.E.Eller at sealedair.com Roger.E.Eller at sealedair.com
Mon Mar 23 09:43:09 EDT 2009

>> Roger wrote:
>> First of all, when I need database tips, I search the list for "Sarah
>> Reichelt" because well... SHE'S AWESOME!  I have been using the above 3
>> lines very successfully in Rev 3.0 for accessing a Microsoft SQL
>> via ODBC. I remember having to keep up with a connection id in the past,
>> and closing the database when done. Is that still required when using
>> above method to retrieve a record? What happens if connections are left
>> open?
> Sarah wrote:
> I always store the connection ID in a global or a custom property as I
> generally want to make one than one query after opening a database.
> Then when my app is closing, or I am finished with the database, I use
> that connection ID to close the database.
> Alternatively, you can just close all connections when the app is
> quitting, using something like this:
>   put revOpenDatabases() into connectList
>   repeat for each item c in connectList
>     revCloseDatabase c
>   end repeat
> I'm not sure what happens if you quit without closing any connections.
> The database library might close them automatically, or the server
> might have to time you out, but I think it is better to close the
> connections yourself when you no longer need them.
> Cheers,
> Sarah

As usual, this was exactly what I was looking for. Thanks again Sarah! :-)

Roger Eller <roger.e.eller at sealedair.com>

More information about the Use-livecode mailing list