SQLite 多线程开发 线程池问题

火车采集器商业版里面采用的是SQLite数据库存储数据,以前一直被多线程操作SQLite出现错误烦恼,以前的解决办法一直是在操作数据库时lock对象。
经过今天一天的研究,终于解决了这个难题。

问题解决提示:
1.研究System.Data.SQLite.dll (http://sqlite.phxsoftware.com/)附带的source test项目内的 TestCases.cs  多线程单元测试部分代码。

需要对每个连接克隆再使用 ((ICloneable)this.Connection).Clone() as DbConnection;

2.结合使用 ta8210兄的 实现高效的数据库连接池代码(http://blog.csdn.net/ta8210/archive/2007/04/24/1582162.aspx


在多线程多插入(非事务插入)及火车头程序中表现良好。算是基本解决了这个头疼的问题
引用通告地址: 点击获取引用地址
评论: 2 | 引用: 0 | 阅读: 1046
luiqt [ 2010-01-08 01:30 | 回复 | 编辑 删除 ]
太好了
zxvxvz [ 2010-05-27 14:35 | 回复 | 编辑 删除 ]
See how many home game of the union, look at the game as well as how much like a brother's friends, see how many games make you remember my memory, everything all world of warcraft cheap wow gold will also become a kind of culture. Regardless of the world of warcraft and "dangerous road before," whether world of warcraft in China can go far, as long as you have the culture, I also will rise, and we also will create myth.
  • 1 
发表评论
昵 称: 密 码:
网 址: 邮 箱:
验证码: 验证码图片 选 项:
头 像:
内 容: