Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I am new in the world of SQL database and C# programming, so I am seeking here an advice from experts more than steps or code.

In Brief:

I am making an application that will copy data from a certain database to another one, but the copying will depend on different criteria, this criteria include values in both DBs. Also I want to modify certain values in the newly added rows. I have a couple of ideas in mind on how to do it, but I am concerned about the speed of the process and its efficiency as this copying will be repeated every amount of time (30 secs ).

In Details:

My application will copy data from a Kiwi Created Database (Kiwi is a syslog server that collects Logs from network elements and places them in a DB) to another DB. I want to read the newly added logs from the Kiwi sever and places them in a new DB, if the Logs occurs for the first time, then I add them to the new DB. If they are repeated, some counters should be incremented. Also the Logs usually include source and destination, so I want to consider the logs sent from either the source or the destination as one log. This process should be repeated every certain amount of time (Something around 30 secs).

My ideas about how to do that is:

1. To put both Databases in two array list and then do my processing on them, after that I shall return the values to the DBs.

2. Doesn't use an intermediate array at all, just read row by row from the Kiwi DB and for each row, query the new DB for the values and then update or add them.

Then second method seems to be easier and more straight forward, but it will include too much connections to the DB, I am afraid that will slow down the application.

I hope I represented my question clear enough, I am waiting for your usual support and help.
Posted
Updated 28-Jul-11 8:57am
v2

1 solution

I suggest a trigger on the first DB to copy data to the second only when the data changes to require it. This will spread out the load and allow you to at a minimum simplify the request you make every 30 seconds.
 
Share this answer
 
Comments
zakariawaheeb 29-Jul-11 8:49am    
Thanks Christian,

My problem is not when to make the copy, but how to make it. Anyway, I used the second method (didn't use any intermediate array) and everything seems to be working fine till now.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900