It won't throw an Exception on a missing db configuration, it probably throws an exception because you want to run a DB command while not having a db configuration.
So the obvious answer is: don't do that. ;)
Any idea what runs the DB command? Perhaps you're using Sessions with a db backend, and you autoload the Sessions class?