开发者

Windows Mobile - Keeping SQLite Database Connection Open

I am using ADO.NET Provider on Windows Mo开发者_如何学Cbile (C#) to connect to SQLite database.

Will keeping database connection open for application life create any issue? I am thinking to keep it open because,

  1. It will not allow user to delete database file (as it's already in use).

  2. It will not allow other processes to modify it (as it's already in use).

  3. Does not require to open connection each time.

Please let me know if there will be any issue with it.


The best way is to keep reference of the connection object in a static way. You should know that the connection can drop after a while, and you must prepare the code to handle reconnection.

Something like clsDbUtils.getConn() would do the job inside if sees the connection is no longer valid.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜