I recommend that you forget that you ever saw that website or anything in it. It's all wrong, and not just the parts you've already discovered.
There should have been a secondary stacktrace I think telling more what's wrong, plus the actual Exception line is missing. Although based on the sample code, I'd say that the database driver wasn't in the classpath.
J2EE is an expensive platform in terms of the amount of effort it takes to develop a webapp. So one of the things you would normally do is use a database connection pool instead of grabbing a driver directly. BTW, Class.forName() for drivers hasn't been necessary for quite a few years now, since modern JDBC drivers contain the necessary meta-data already.
A connection pool allows 2 benefits.
1. It allows multiple users access to the database without having to have each use open a new connection. Creating connections is a lot of work, but re-using pooled connections is not.
2. It allows you to abstract yourself more from the database, since the database connections are defined to the webapp server instead of to the webapp itself. While SQL isn't quite portable enough that you can swap MySQL for MS SQL Server without risk, it does make it a lot easier.
An IDE is no substitute for an Intelligent Developer.