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)
在多线程多插入(非事务插入)及火车头程序中表现良好。算是基本解决了这个头疼的问题
评论: 8 |
引用: 0 |
阅读: 2671
| 太好了 |
| I am certainly thankful to you for providing us with this invaluable info. My spouse and I are truthfully grateful, precisely the computer data we needed discount oakley sunglasses |
| The north face However, most people need after canada goose parka a certain period of time under the expert guidance of training to master this knowledge, and here one of the most toxic non-toxic simple way to identify wild plants, north face for emergency use. Usually collected plants cut a small hole, put a pinch of salt, buy canada goose and then carefully observe whether the change in the original color, color of the plant can not eat normally.GT |
| Now choose Cheap Canada Goose Parka Jacket at Canada Goose Sale ne store is offering you a large number of cheap Canada Goose Jackets of you.So don't hesitate to place an order here,buy a Canada Goose Coats to shChilliwack Jacket,Canada Goose Expedition Parka Jacket and Canada Goose Parka Jacket.All items sale on our store are free shipping, welcom to buy one. |
发表评论
订阅
上一篇
返回
下一篇