For pulling the data from the blockchain to the database, you can use the walletnotify setting to have a script triggered every time a new transaction occurs which is of interest to the node. Or you can poll the node and pull out information one block at a time using getblock with verbose set to 4.
As for pushing the data directly from the database to the blockchain, we would not recommend this. Instead, write the new data to the blockchain directly, and then let it be pulled into the database (or into multiple databases) using the mechanism in the above paragraph.