title: Synchronize Berkeley DB with Mysql
body: <p>I have a legacy system that has been ported to a modern system and uses berkeley database. It is compiled with open cobol.<br>
  In the previous system the serialized fixed data CISAM files were converted one time per day to microsoft database using ACCESS macros in order to be used from a simple web front end.(one way) 
  I want to create a new web front end and i want data to be real time updated...<br>
  The problem is that berkeley database is key value database and doesnt support sql.<br>
  So the problem here is 
  Should i create a web service that provides data to the web front end using Berkeley database ?
  OR 
  Should i synchronize berkeley database with a relational Database (Mysql,postgresql) </p>
  
  <p>In the first case there wouldnt be a synchronization issue.But the problem is that flexibility  is very limited... For example sorting by a collumn that it is not indexed requires custom sorting function... Summing some fields requires reading all the record data and then summing manually.. </p>
  
  <p>In the second case the simple way is to just read and convert to database . I cant figure out a way to check what has been updated...inserted or deleted.</p>
  
  <p>But i tend more to second method.. using the following algorithm
  Check every 5 minutes the file modifation date... 
  Open files that have been modified...  Then get all the keys and compare to cached keys array.
  Then loop through each record and check if data hash is the same with cached hash.<br>
  Then delete/insert ..</p>
  
  <p>ANy other ideas?</p>