I've got a procedure that reads raw data and creates this to some database every couple of seconds.
What's the easiest method to know if the database continues to be written to? I understand that Oracle and MS-SQL may use triggers or something like that to talk with other services, however i was wishing there will be a technique that will use more kinds of SQL databases (SQL lite, MySQL, PostGRES).
Your real question is missing specifics required for a great answer but I'll try it out. Triggers are great for focusing on tables but when you are looking at system-wide creates then you will want a much better method that's simpler to keep. For system-wide creates I'd investigate techniques that identify alterations in the transaction log. Regrettably, each vendor implements this part in a different way, so one way that actually works for those suppliers isn't likely. That's, a technique that actually works inside the database server is not likely. But there might be more elegant ways outdoors from the server in the OS level. For example, when the transaction log is really a file on disk a simple script of some kind that picks up alterations in the file would indicate the DB was written to.
Bear in mind you've requested simply to identify a db write. If you want to know which kind of write it had been then you may require in to the transaction log to determine what's there. Which will certainly be vendor specific.
It is dependent on which you want to complete. If it's something exterior towards the database that should be began a simple poll from the database would have the desired effect, otherwise a db specific trigger is most likely best.
If you wish to be database independant, polling can function. It's not so efficient or elegant. Additionally, it works if you're cursed to presenting a database that does not support triggers. A workaround that we have used previously is by using a script that's timed (say via cron) to perform a
select MAX(primary_key_id) from saidTable. I'm presuming that the primary secret is a b consecutive integer and it is indexed.
After which compare that towards the value you acquired the final time you went the script. When they match, tell the script to exit or sleep. Otherwise, do your factor.
You will find other conditions with this particular approach (ie: backlogs when the script takes too lengthy, or concurrency issues, etc.). Not to mention performance may become an problem too!