Revert "Revert "Connected scripts with database""

This reverts commit 9ee4b8ca7cebfbca819984fc78f1008ec0f02af9.