This content has been marked as final. Show 5 replies
My tendency is to instantiate it once and keep it alive, but there are
valid arguments for and against. This approach (doing so once) can
provide a marginally more resonsive UI - given that you don't have to
re-open the DB or connection every time you want to execute a query. The
downside is that it can lock the DB and potentially corrupt it if you
crash. Which xtra are you using?
I have done it both ways, and each have benefits. Instantiating it once
and using a global variable to track it is generally a little bit faster
(not really noticeable... but it is faster) since you don't need to keep
reopening the connection. Some xtras have memory leaks if you don't
dispose of the instance (forgot which, but I know there was at least
once that had a pretty bad memory footprint if you left the db instance
open for a long time). These days, unless there is a serious speed
requirement where a few ms here or there really matter, I tend to open
and close the db instance as needed and not save them globally.
Valentin has addressed some issues with the Xtra in the last couple of days which may correspond to what you have been experiencing... The latest version is here:
I just discovered Valentin's site. Extremely impressive!