The overhead in opening a connection only occurs when the database is not empty. We force some initialization to occur during an open operation to report errors right away rather than waiting until the first statement is executed. The initialization time is proportional to the number of tables and indexes within the database, as meta-data is read and loaded into memory for each.
Generally you should only have need for a single connection. As long as you are using the same connection for each operation the connection will take care of serializing access to the underlying database whether you are using the aysnc or sync API. Using a single connection will avoid the issues of locking within the same AIR application. The use-case for multiple simultaneously open connections to the same database, would be if you wanted to have more than one async read occurring simultaneously. Hope that helps some, jw --- In [email protected], Cameron Childress <[EMAIL PROTECTED]> wrote: > > Looking for a pointer to some advice about a few SQLite issues. > > Is it generally best practice to keep a connection open and keep reusing > it (perhaps stashing it in the ModelLocator) or is it better to recreate > a connection each time you need to do a SQL operation? > > Also, I have read some about why to use sync vs async connections to > SQLite, but not much about using both sync and async in different parts > of an AIR application. I've found that keeping a sync connection open > and stashed in a ModelLocator locks the db so that I can't make async > connections. Since SQLite is a file based DB, this is not surprising at > all, but it does definitely call into question my initial effort at > keeping a connection open and just reusing it all over the place. > > Anyone have any advice or any good blog postings about this subject? > Specifically about when best to make and destroy connections. > > Thanks! > > -Cameron >

