I can't see any way for that code to produce the error you describe, so I think it will help if you can explain more about exactly what you're doing. You might start by taking a look at our FAQ: Tips for writing R-related questions.
The best way for you to get help is to turn your question into a reproducible example. That way, you and your helpers can be sure you're all looking at the same thing!
Thanks, @jcblum! The code comes from a tutorial module, so I believe the error doesn't pertain to the codes but more on the issues in installation of packages or configuring a database probably.
In that case, can you please include the code you've used to connect to the database (obviously filter out any sensitive information like passwords, etc).