actually you are using it correctly.
the problem is not related to the use of the Class.forName() . your code works fine in my computer.
perhaps it is a classpath related issue?
or maybe you dont have
Jdbc classes?
check to see if u have the java.sql package?