multithreaded programming

  • Thread starter Thread starter Duncan Mole
  • Start date Start date
D

Duncan Mole

Hi,
Does anyone have a good design framework for multithreaded database
applications? I feel I shoul share a single instace of the database
connection between the threads but don't have a way of regulating access to
this connection.

I have a singleton class and tried putting the connection object in there.
Within the accessor property I tried to implement a thread sleep until the
connection state was not open but this did not work.

Any thoughts?
 
Threading shouldn't have to be confused with Connection Sharing. That is
where the beauty of ADO.NET comes in - you don't have to do all this
hardwork. As long as the connection string is exactly the same, and you
haven't explicitly disabled this capability of ado.net - ado.net will pool
connections for you in the most optimum way.

For more information please see -
http://dotnetjunkies.com/WebLog/sahilmalik/archive/2004/11/12/31798.aspx

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 
Back
Top