I am using a VCL TCPServer components which fires events everytime a data is received on a tcp port. Within the event data is available into text parameter of the procedure. B
It's not really an answer to your question, but do consider the risk of your application failing (for any reason) between receiving the data and executing the INSERT
.
If you use a local store of some kind as an intermediate to mitigate this risk, consider the risk of a crash while that store is being updated.
RDBMS vendors go to great lengths to ensure that data that has been accepted by successful completion of an INSERT
, UPDATE
or similar command will not be lost or corrupted. Can you put in similar effort?
Generally speaking, if you are accepting data piecemeal rather than in bulk, I would probably keep an open connection to the database and insert data as you receive it, and only send an acknowledgement back to the consumer of your application once it has been pushed to the database.