Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 742
  • Last Modified:

Some sort of Informix equivalent of cksum on an SQL result

I have a connection to a remote database that I want to regularly check for data changes. To determine whether there's been a change, I don't want to have to download the entire SQL result and compare it with the previous result.

What would solve my issue is the equivalent of the cksum command in linux, which gives a digital fingerprint of a file. That way, I would be able to just compare the fingerprint of the remote SQL with the fingerprint of the same SQL run on my local database, and download the full result when they differed.

One idea I had was something like a bitwise-sum of the md5 function result run on a column, but I'm not aware of Informix being able to manage a bitwise sum OR md5!

All suggestions appreciated, but yes I do know it would be lovely if there was a trigger on the remote table that updated a changedate upon changing... I can't change the remote database though.
0
Terry Woods
Asked:
Terry Woods
  • 4
  • 3
3 Solutions
 
amroxCommented:
md5sum /path/to/database_file

should be available on most linux distros

perhaps store previous value and current value in seperate variables, and an if statement to compare?
0
 
Terry WoodsIT GuruAuthor Commented:
I need it to be done with SQL as I don't think I can get access to linux on the remote server.
0
 
gheistCommented:
select count(*);
select max(table.row_id)

Also you can set triger on update to emit dates of last change into side table.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Terry WoodsIT GuruAuthor Commented:
Thanks - that would cover inserts and deletes.

However, I can't add a trigger, so do you know of any way to check for updates to the data?
0
 
gheistCommented:
Indeed - if you hold DBA privilege you can add a trigger. There is no other way to check updates.
something like inserting or updating tablename,now() in some table
0
 
Terry WoodsIT GuruAuthor Commented:
Thanks very much for your help!
0
 
Terry WoodsIT GuruAuthor Commented:
Not the answer I wanted to hear, but still the correct one I believe! I'm crossing my fingers there are some on-update triggers on the tables I'm interested, but I suspect I'm out of luck.

Next best way to check for updates I think is selecting the minimum dataset possible (that I care about), and downloading it to my local server where I can compare it with a previously saved copy. It's a real shame the db engine can't do a checksum on the result of a select - it would save lots of trouble!
0
 
gheistCommented:
Some updates hit same page, some create new data page, so querying system statistics tables is not definite indicator also.
There is nothing wrong that each query is processed anew.
You can add your md5 checksum, that includes rowid also.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now