SQLite 多线程开发 线程池问题
作者: 火车头 日期: 2009-08-04 23:23
火车采集器商业版里面采用的是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)
在多线程多插入(非事务插入)及火车头程序中表现良好。算是基本解决了这个头疼的问题
经过今天一天的研究,终于解决了这个难题。
问题解决提示:
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
| 太好了 |
| 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. |
发表评论
订阅
上一篇
返回
下一篇