Thanks for the heads up. I had no idea.
Since I tried to use a model and failed, I became curious. I have done one more example using this tutorial, and it went fine. Do you have any idea why is it complaining about my database not being open, when it clearly is, judging from the fact that my query worked fine.