You should look into one of the database-related unit-testing frameworks like dbunit.
These frameworks make for repeatable database tests by setting up up the database, loading initial data, running the tests, then deleting the data so that you have a clean venue for the next test cycle with no leftovers to pollute things. Commonly, they'll also hook to a lightweight database that runs locally so that you can do these tests without needing access to a heavyweight database server.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.