added datbase connection logic to Variable object