Can you really effectively tail a database table so that whenever a new row is added a credit card applicatoin is immediately informed using the new row? Any database may be used.

  • Yes, when the database is really a flat text file and appends are carried out in the finish.
  • Yes, when the database supports this feature in certain other look into the relevant manual.
  • Otherwise, no. Databases are usually binary files.

Make use of an ON Place trigger.

you will have to look for specifics regarding how to call exterior programs using the values included in the placed record, or else you will write your 'application' like a SQL procedure and also have it run within the database.

it may sound like you will need to improve on databases generally before you decide to fresh paint yourself right into a corner together with your command line approaches.

I don't know but this may work with primitive / flat file databases but so far as i realize (and that i might be wrong) the current database files are encoded. Hence reading through a recently added row wouldn't use that command.

I'd imagine most databases permit write triggers, and you might have a script that creates on write that informs you a number of what went down. I'm not sure what information could be available, because it would rely on the person database.

tail on Linux seems to become using inotify to inform whenever a file changes - it most likely uses similar filesystem notices frameworks on other os's. So that it does identify file modifications.

Nevertheless, tail works an fstat() call after each detected change and won't output anything unless of course how big the file increases. Modern DB systems use random file access and reuse DB pages, therefore it is very entirely possible that an placed row won't make the backing quality to alter.

You are best using inotify (or similar) directly, as well as best if you are using DB triggers or whatever mechanism your DBMS purports to watch out for DB updates, since not every file updates are always row insertions.

I had been just in the center of posting the exact same response as glowcoder, plus also try this:

The reduced-tech method of doing it's to possess a timestamp area, and also have a program operate a query every n minutes searching for records in which the timestamp is more than those of the final run. Exactly the same concept can be achieved by storing the final key seen if you are using a sequence, as well as adding a boolean area "processed".

With oracle you are able to choose an psuedo-column known as 'rowid' that provides a distinctive identifier for that row within the table and rowid's are ordinal... new rows get designated rowids which are more than any existing rowid's.

So, first choose max(rowid) from table_title

I suppose that certain cause of the elevated real question is that you will find many, many rows within the table... which means this initial step is going to be taxing the db just a little and take a while.

Then, choose * from table_title where rowid > 'whatever_that_rowid_string_was'

you've still got to periodically run the query, but it's now only a fast and affordable query