[FixRM #8310] Added check to make sure a database was connected

Plugin would access the db even when it was not connected, resulting in a crash. Added a check, and a print_status to alert the user that the db was not connected.