Re: SQL Compact Edition - connection and multi-trheading
- From: "Ginny Caughey [MVP]" <ginny.caughey.online@xxxxxxxxxxxxxx>
- Date: Wed, 13 Jun 2007 12:27:38 -0400
It sounds like your plan could work, but you'd want to serialize access to your singleton in a multi-threaded scenario. Also you'll need to make sure that the connections are all closed eventually. As long as each thread has its own connection, I don't see other issues immediately.
--
Ginny
"José Joye" <Me@xxxxxx> wrote in message news:465e6ae0$0$3809$5402220f@xxxxxxxxxxxxxxxxxx
This question relates to another one I posted. However it derives from the original post and found better to start a new one.
I'm writting a library application that will be used internally within our company (dB is used in RO mode). I already expect it to be used by multithreaded applications.
Having that in mind, I naively designed it with connection pooling in mind ( --> get a connection, use it and release it as soon as possible [kind of single call pattern]).
However, the connection pool is not supported by the SQLServer CE 3.1 and this means every time I'm asking for a connection object I have to wait about 2ms on my desktop and I expect to be much more on the CF devices
The question I have is related to connection together with multithreading.
In fact, to overcome the speed problem I have, I'm planning to write a kind of "DataObjectProvider singleton Class" that will hold a set of already initialized "db onnection".
Whenever needed, clients of this class may ask for an available connection and when they are done, they can replace it in the pool.
1. Assuming, my code ensures the connections are really given back to the singleton class when not needed anymore. Is this design valid?
2. Does it cause problem if different threads will query for connections (which were created by a different thread)?
3. Assuming I keep the connection open, when I place them back to the pool, will it make problem when used in multithreaded environment.
Thanks,
- José
.
- Prev by Date: Re: A delete takes too much time
- Next by Date: TableDirect index order
- Previous by thread: Re: SQL Compact Edition - connection and multi-trheading
- Next by thread: OleDb connection string to Sql server mobile edition
- Index(es):
Relevant Pages
|
Loading