开发者

can we access single SQLite database from multiple Flex application?

Is it possible to simultaneously access single SQLite database at server from multiple clients applications of Flex(web and AIR applications)?

Is there any locking of database?

What i am trying todo is, i 开发者_如何学Pythonwant to store my data in SQLite database at server side and i want that Flex applications both in web and AIR can simultaneously fetch data from the same database at server.

Is this possible to achieve with SQLite and Flex applications?

Is there any Better way to achieve this in Flex?


I've recently been doing quite a bit of wrestling with SQLite and concurrency. It's sort of a bitch, but it IS doable.

The issue is, when you issue writes to a SQLite database you lock the entire thing (in comparison to row locking, which other solutions support). If you're issuing tons of writes from multiple locations/threads, you're going to wind up hitting walls when 'database locked' errors show up.

I think it's possible to increase the timeout on SQLite queries so these issues become... slightly smaller issues. They are still issues nonetheless.

Another issue you may run into with SQLite is using FOR UPDATE. This is used when you need to retrieve some rows, compute things given the data, then issue an update without other queries reading those rows in the meantime. It does not support such a construct. You can get around it, but you have to explicitly lock the entire database while you do this update (you'll see someone addressing this here).

Concurrent reads are fine, so maybe it will work for you.

I suppose the TL;DR of this whole thing is that it depends on how many concurrent hits you expect to be having on the database. If you expect a lot, perhaps you should look into a more robust database solution like postgresql.

I'm not a database expert by any means, but I hope that points you in the right direction.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜