473,662 Members | 2,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need ideas on multi threaded db update

cj
I have to take all records in a SQL db that have an empty val_code field
and process and update the records with a code number in the val_code field.

The processing is done by sending select info from each record to a
remote server. The remote server returns the code number to be put in
the val_code field. The remote server will allow me to have up to 5
"sessions" open with it at a time.

I'm thinking each "session" will have to be in a separate thread. I
also assume a main thread must exist to interact with the database. Can
anyone give me any other ideas?

Thanks.
Mar 8 '06 #1
6 1257
Hi

Based on my understanding, you will get something from a DB.
And then send request to a remote server which allow 5 "session" and then
update DB.
Can you describe how did you send the request?
Via WebService or anything else?

What do you mean by "session" here?

If you mean a multitheading issue in Winform, we can use the Control.Invoke
to marshal the cross thread call on the main thread.
Safe, Simple Multithreading in Windows Forms, Part 2
http://msdn.microsoft.com/library/de...us/dnforms/htm
l/winforms0816200 2.asp

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 9 '06 #2
cj wrote:
I have to take all records in a SQL db that have an empty val_code
field and process and update the records with a code number in the
val_code
field.
The processing is done by sending select info from each record to a
remote server. The remote server returns the code number to be put in
the val_code field. The remote server will allow me to have up to 5
"sessions" open with it at a time.


How is the val_code derived from the data? If there are a limited number of
val_code values then you could get them all in one go, or at least implement
a local cache (Array/ArrayList/whatever else might be appropriate) so you
don't have to query the remote server so much.

Are you using one database to update another database on a different
computer, or is it all within the same database? If the latter then surely
it would be more efficient to do it all in a stored procedure in the
database.

Andrew
Mar 9 '06 #3
cj
Thanks Peter and Andrew, I'll try to explain better. The program will
send fields from the records w/o a val_code to the remote server (it's a
soap web service kinda thing but this should be unimportant as it is set
in stone and I have the code necessary to send/receive available) the
response could take milliseconds or several seconds. Records need
processing very quickly. They allow me to have 5 "sessions" (that's the
server folks word for it) open with their server at the same time. I
don't have to wait for the first request to come back to submit another
I can submit up to 5 at a time but each request is done in a seperate
"session" or connection to the server. The only way I see having 5
sessions open on one pc at a time is multiple programs or multiple
threads. Threads being my choice.

I've been thinking since I asked the question (dangerous, I know) and I
see a main thread that launches 5 worker threads. Each worker thread
creates a session and logs in to the server. The main thread meanwhile
pulls a group of records needing validation from the sql server. Then
as long as it has records starts a loop checking to see if worker thread
1 is busy, if thread 1 is the main thread checks worker thread 2, if
it's busy 3 and lets say 3 isn't so it passes the record to worker
thread 3. then picks the next record and check to see if 1 is busy then
2 etc. Each thread would be responsible for updating the sql database
with the changes to the record it was assigned.

To do this I need to know:
--how to reference a thread ie how to know which thread is 1, 2, 3 etc.
--how to set a busy indicator in a worker thread and how to read it
from the main thread
--how to assign a thread a record


cj wrote:
I have to take all records in a SQL db that have an empty val_code field
and process and update the records with a code number in the val_code
field.

The processing is done by sending select info from each record to a
remote server. The remote server returns the code number to be put in
the val_code field. The remote server will allow me to have up to 5
"sessions" open with it at a time.

I'm thinking each "session" will have to be in a separate thread. I
also assume a main thread must exist to interact with the database. Can
anyone give me any other ideas?

Thanks.

Mar 9 '06 #4
cj
Forget this for now--my priorities have been changed.

cj wrote:
Thanks Peter and Andrew, I'll try to explain better. The program will
send fields from the records w/o a val_code to the remote server (it's a
soap web service kinda thing but this should be unimportant as it is set
in stone and I have the code necessary to send/receive available) the
response could take milliseconds or several seconds. Records need
processing very quickly. They allow me to have 5 "sessions" (that's the
server folks word for it) open with their server at the same time. I
don't have to wait for the first request to come back to submit another
I can submit up to 5 at a time but each request is done in a seperate
"session" or connection to the server. The only way I see having 5
sessions open on one pc at a time is multiple programs or multiple
threads. Threads being my choice.

I've been thinking since I asked the question (dangerous, I know) and I
see a main thread that launches 5 worker threads. Each worker thread
creates a session and logs in to the server. The main thread meanwhile
pulls a group of records needing validation from the sql server. Then
as long as it has records starts a loop checking to see if worker thread
1 is busy, if thread 1 is the main thread checks worker thread 2, if
it's busy 3 and lets say 3 isn't so it passes the record to worker
thread 3. then picks the next record and check to see if 1 is busy then
2 etc. Each thread would be responsible for updating the sql database
with the changes to the record it was assigned.

To do this I need to know:
--how to reference a thread ie how to know which thread is 1, 2, 3 etc.
--how to set a busy indicator in a worker thread and how to read it
from the main thread
--how to assign a thread a record


cj wrote:
I have to take all records in a SQL db that have an empty val_code
field and process and update the records with a code number in the
val_code field.

The processing is done by sending select info from each record to a
remote server. The remote server returns the code number to be put in
the val_code field. The remote server will allow me to have up to 5
"sessions" open with it at a time.

I'm thinking each "session" will have to be in a separate thread. I
also assume a main thread must exist to interact with the database.
Can anyone give me any other ideas?

Thanks.

Mar 9 '06 #5
Hi CJ,

Thanks for your update!
If you still have any concern, please feel free to post here.
Thanks!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 10 '06 #6
cj,
Forget this for now--my priorities have been changed.

I don't know if I wrote this already to you, I think that to let that be
forever is a good choose, however.

Let the Server do its job by handling the sessions in a proper way, and
don't interfere in that.

Just my thought,

Cor
Mar 10 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1670
by: Mike Rovner | last post by:
Hello, Please advise on multi-threaded list *append*: import time, random, thread aList = def main(): for i in range(10):
0
1786
by: Royco | last post by:
Hi, Situation as follows - a C++ component with OCI-calls running under the control of COM (w2k) - component is marked transactional - the component connects to database1 but wants to update tables in database2 (through a databaselink). - Oracle version is 8i on client and server Initially we received an Oracle error 24777 : Use of non-migratable database
0
4923
by: Ganbold | last post by:
Hi, I'm new to multi-threaded programming and reading the book "Programming with POSIX Threads" and trying to understand concepts and coding. What I'm trying to do is to rewrite mysql client application (which calculates ISP dial-up customers' billing) into multi-threaded version.
2
3653
by: Michal Przytulski | last post by:
Hi, I'm looking information abouth runing PHP CLI application in multi-threaded - on http://www.php.net/manual/pl/ref.pcntl.php i found information abouth process control - but is PHP support multi-threaded ?? Can anyone help ??
0
1811
by: Stuart Norris | last post by:
Dear Group, I am attempting to write a "splash" and "status" Form using a second thread. I wish to use this Form to display status information to the user when I do CPU intensive work in my GUI during startup. I wish to also use the same Form after startup as well if I do something CPU intensive. I have developed a multi-threaded application however the very first
2
1925
by: Naveen Mukkelli | last post by:
Hi, I'm working on a multi-threaded application. I'm using ThreadPools. One of the requirements of the application is, if certain exception occurs all the counters have to be reset. I have noticed that some threads, even after resetting the counters, have the old values.
1
1979
by: Mullin Yu | last post by:
As subject. I have lots of VB6 dll and ocx files and they are single-threaded as VB6 doesn't support multi-threaded indeed. Can I wrap anything at .NET so that multi-threaded feature can be provided? Thanks! Mullin
4
2846
by: Web_PDE_Eric | last post by:
I don't know where to go, or what to buy, so plz re-direct me if I'm in the wrong place. I want to do high performance integration of partial differential eqns in n dimensions (n=0,1,2,3..etc) I want to do (fast) graphic output of the results. I used to use C. I want to upgrade my computer. Do I get dual core? Does C# support dual-core? Is C# as fast as the old C? Is there a new C? (or is C# the new version of C?) Is Visual Studio...
14
3394
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
As far as I know, the C Standard has no mention of multi-threaded programming; it has no mention of how to achieve multi-threaded programming, nor does it mention whether the language or its libraries are suitable for multi-threaded programming. For people who are fond of portable C programming, what's the best way to go about multi-threaded programming? I've been reading up on POSIX threads a little, they seem pretty ubiquitous....
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.