Dave: I'm not familiar with SMF but maybe there is an error log somewhere with more info? "Cannot connect" is too vague, could be that the databse doesn't respond to the request at all, or it could actively deny it for some reason.
Also, the database server probably keeps its own logs, maybe you could find something there. Depends on what you are using (MySQL?) and the settings.
It would probably help to know the time so you can search the logs easily, so next time this happens to me I'll post the exact time here. I suggest everyone would do this, a few timestamps should be enough. Also, make sure to use the server time (shown under your name on the top of the page) since it can be a little different from your local time.