Added database connection to message system

We've got 99 problems but a database ain't one.