By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,905 Members | 1,616 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,905 IT Pros & Developers. It's quick & easy.

Stored procedure and threading help.

P: n/a
Hi all,

i am having application which is using stored procedure written in sql
server.
I want to develop multithreaded applicaton.
The store procedure is returing list of rows of table.
what i want to ask is, if i tried to call same stored procedure in
different thread , is it possible or it will created problem in
multithreaded application.

If yes how to get rows returing from stored procedure.

Any help will be appreciated.
thanks in advance.

Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
It should not cause a problem as long as you are not trying to relate the
different data pulls. If you are doing this

Spawn thread
Call for user information

Spawn another thread
Call for user orders

Spawn another thread
Call for user order details

When all are returned, relate them

That could be problematic as there is no locking mechanism across all calls,
which means data could be updated rendering user or orderinformation invalid
when you call for details.

If you are pulling data asynch that is not related, you should not have any
problems. Looking at your post, it appears you are simply calling the same
stored procedure on multiple threads (for multiple users?).

Short answer: As long as the threads are not talking to each other (or
aggregating for the main app thread to relate data), you should not have any
problems.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"tr**************@yahoo.com" wrote:
Hi all,

i am having application which is using stored procedure written in sql
server.
I want to develop multithreaded applicaton.
The store procedure is returing list of rows of table.
what i want to ask is, if i tried to call same stored procedure in
different thread , is it possible or it will created problem in
multithreaded application.

If yes how to get rows returing from stored procedure.

Any help will be appreciated.
thanks in advance.

Nov 17 '05 #2

P: n/a
Hi,
There is no difference at all, just create the thread with method you use
to execute the SP, note that you cannot pass a parameter ( but there r ways
of doing it ) then this method will become the new thread.
Do your stuff and if you store the readed data in a instance variable it
will be available from the originator thread. just notice that you need to
control that nobody access the collection at the same time you are
populating it.

There is nothing really difficult about it.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<tr**************@yahoo.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Hi all,

i am having application which is using stored procedure written in sql
server.
I want to develop multithreaded applicaton.
The store procedure is returing list of rows of table.
what i want to ask is, if i tried to call same stored procedure in
different thread , is it possible or it will created problem in
multithreaded application.

If yes how to get rows returing from stored procedure.

Any help will be appreciated.
thanks in advance.

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.