Added code for storing the result in a SQL DB