Used by the instant messaging application to retrieve data from the database.