473,508 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Load multiple files into Sybase and Threading Question

GG
I need to bcp into Sybase servers different files into different tables
simultaneasly. Is the following architecture thread safe?

1st Have a Helper Class that will take as a parameter the bcpCmd so we
can pass as paremeter to the thread
It looks like this
public class WorkToBeDone
{
string bcpCmd;
public WorkToBeDone(string server)
{
this.bcpCmd = bcpCmd;
}
public void WorkDone()
{
//create a process to call the bcpCmd
}
}
//main thread
WorkToBeDone bcp1 = new WorkToBeDone("bcp1cmd");
Thread bcp1T = new Thread (new ThreadStart(bcp1.WorkDone));
bcp1T.IsBackground=false;
bcp1T.Start();

WorkToBeDone bcp1 = new WorkToBeDone("bcp2cmd");
Thread bcp2T = new Thread (new ThreadStart(bcp1.WorkDone));
bcp2T.IsBackground=false;
bcp2T.Start();

and so on...

//join them as the last step so all work can be completed
bcp1T.Join();
bcp2T.Join();

//get time start and end of bcp1 and bcp2 ojbjects
//send an e-mail about the work done

Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
3 1334
GG,

Without seeing what exactly WorkDone is going to do, it is hard to tell.
While bcp1 and bcp2 can't corrupt each other's state (they don't seem to
have a reference to each other), you have to make sure that whatever
resources they are accessing are thread-safe as well, in addition to the
code you are writing.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<GG> wrote in message news:%2***************@TK2MSFTNGP15.phx.gbl...
I need to bcp into Sybase servers different files into different tables
simultaneasly. Is the following architecture thread safe?

1st Have a Helper Class that will take as a parameter the bcpCmd so we
can pass as paremeter to the thread
It looks like this
public class WorkToBeDone
{
string bcpCmd;
public WorkToBeDone(string server)
{
this.bcpCmd = bcpCmd;
}
public void WorkDone()
{
//create a process to call the bcpCmd
}
}
//main thread
WorkToBeDone bcp1 = new WorkToBeDone("bcp1cmd");
Thread bcp1T = new Thread (new ThreadStart(bcp1.WorkDone));
bcp1T.IsBackground=false;
bcp1T.Start();

WorkToBeDone bcp1 = new WorkToBeDone("bcp2cmd");
Thread bcp2T = new Thread (new ThreadStart(bcp1.WorkDone));
bcp2T.IsBackground=false;
bcp2T.Start();

and so on...

//join them as the last step so all work can be completed
bcp1T.Join();
bcp2T.Join();

//get time start and end of bcp1 and bcp2 ojbjects
//send an e-mail about the work done

Thanks

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #2
GG
I was mostly concern with bcp1 and bcp2 objects.
Glad to hear that cannot corrupt each other.
Thanks for your reply.


*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3
GG,

The thing is, they can, depending on what that code is. I mean, they
might both access a static variable, they might have references to each
other, things of that nature.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<GG> wrote in message news:eT******************@TK2MSFTNGP10.phx.gbl...
I was mostly concern with bcp1 and bcp2 objects.
Glad to hear that cannot corrupt each other.
Thanks for your reply.


*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #4

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

Similar topics

8
11719
by: MrTrix | last post by:
Hello: I'm having a problem formulating the code to execute a multiple line command. I'm trying to execute something like: set rowcount 100000 declare @rowct int select @rowct = 1 while...
3
3842
by: Jibba Jabba | last post by:
How much traffic/load can a database server running MS SQL server take before it can't handle it anymore? And when that time comes, what are the recourses? Am I able to load balance it between...
6
3225
by: Shabam | last post by:
A web application of mine developed using C# + MS SQL runs fine normally. However when I stress test it with a load testing software (using about 60 simultaneous users) some instances start...
4
16735
by: DG | last post by:
Hi, Can anyone advise how to execute multiple statements in a single query batch. For example- update customers set customer_name = 'Smith' where customer_name = 'Smyth'; select * from...
1
1712
by: Raoul Minder | last post by:
Hi all I am new to threading! I am developping a newsletter tool including a dispatch manager that should schedule sendings. The Web layer kicks a remote object hosted by a windows service...
4
2198
by: Ravi Ambros Wallau | last post by:
Hi: We developed a set of ASP.NET Web Applications that never runs in stand-alone mode, but always inside a portal (Rainbow Portal). All modules are copied on that portal. My question is: load...
7
6521
by: P. Adhia | last post by:
Sorry for quoting an old post and probably I am reading out of context so my concern is unfounded. But I would appreciate if I can get someone or Serge to confirm. Also unlike the question asked in...
3
7960
by: Ultrak The DBA | last post by:
As a converted sybase dba, I have a question. In sybase a command can be executed multiple times by placing a go 1000 at the end of the statement. Such as: insert into a (col1, col2)...
4
2247
by: tdahsu | last post by:
All, I'd appreciate any help. I've got a list of files in a directory, and I'd like to iterate through that list and process each one. Rather than do that serially, I was thinking I should...
0
7231
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,...
0
7133
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...
0
7405
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...
1
7066
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...
0
7504
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...
0
4724
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...
0
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
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 ...

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.