Some sort of Informix equivalent of cksum on an SQL result

Posted on 2009-05-04
Last Modified: 2013-12-24
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.
Question by:Terry Woods
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3

Assisted Solution

amrox earned 50 total points
ID: 24309026
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?
LVL 35

Author Comment

by:Terry Woods
ID: 24309395
I need it to be done with SQL as I don't think I can get access to linux on the remote server.
LVL 62

Accepted Solution

gheist earned 450 total points
ID: 24315378
select count(*);
select max(table.row_id)

Also you can set triger on update to emit dates of last change into side table.
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

LVL 35

Author Comment

by:Terry Woods
ID: 24319974
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?
LVL 62

Assisted Solution

gheist earned 450 total points
ID: 24323053
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
LVL 35

Author Closing Comment

by:Terry Woods
ID: 31577887
Thanks very much for your help!
LVL 35

Author Comment

by:Terry Woods
ID: 24371885
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!
LVL 62

Expert Comment

ID: 24372992
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.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question