Re: query with a callback?
Re: query with a callback?
Do you control what goes into the database?
(Not a fan of triggers, too much like 'magic')
Re: query with a callback?
Thanks arielb, I will look into those, although the wikipedia article doesn't really explain how to use them. I'll do a quick google search to see what I can find.
@Tolls: What do you mean? The software that I need this "callback" for is a separate software from the one(s) that will input data into the database. I do not know who or what will input data into the database (well, I actually do, but I need to keep it generic, so as to allow new software to input data into the database without needing to re-code everything), although I do know some information on the nature of the data that will be input into it (I have the table definition and I know what is supposed to go into the time field for instance, so I know that a more recent entry should have a later "time" value). The software that input data into the database were/are/will be developed independently from the one I'm working on right now.
Not sure if that answers your question?
Re: query with a callback?
OK, so it's not a single point of entry to the database (I didn't think it was likely, otherwise you probably wouldn't have asked the question).
Triggers are fired by the database on some event (ie insert or update or delete). For Oracle (which is where I know them from) you might use it for logging, or data manipulation before entry, or data validation.
You could set up a queuing or messaging service (just trying to think of existing techniques), and a trigger could insert into the relevant table? Then some form of JMS thing could monitor that and inform yor software of changes as and when they happen? You might be able to do something with Quartz, though it's not really what that was intended for (it's a scheduler rather than a messaging service).
Failing that you could jury-rig your own, as you thought about in the OP. One table that takes in enough information for you to identify what's happened, a trigger (or triggers) to populate it, then a simple Java thread that monitors it and calls your routines.
There isn't going to be a callback as you are asking the database (and we don't know which breed you are talking about) to call your Java. Which is nothing to do with JDBC.