Link to home
Start Free TrialLog in
Avatar of panJames
panJames

asked on

Concurent insert into database

Hello experts!

My application reads data sent through the Internet.

I use IdTCPServer to read the data.

Sometimes it is lots of data and easy approach like:

onExecute:
 with DataModule2.ZQuery1 do
     begin
       Close;
       Params[0].AsInteger := 1;
       Params[1].AsDateTime := Today;
       Params[2].AsString := lineOfData;
       ExecSQL;
       ApplyUpdates;

     end;

works fine but is not stable, after some time it crashes.

What approach would be appropriate here?

Thank you

panJames
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
the approach depends on a some considerations
> what type of database ? oracle, mssql, interbase ?

you are adding 1 line at a time or is this 1 line the whole text file ?
what is this lineofdata ?

for your delphi approach there are several considerations
are you catching all the errors ? and handling them appropriately ?
what do you do when the database is down ? eg for maintenance
what happens if you lose connection ?

for the database > is there space enough, are you archiving/deleting old data ?