Problem description: JDBC Connection Error
Problem category: Runtime Error
Diagnosis Difficulty: Easy to medium
Difficulty to Fix: Easy
When trying to connect to a database using JDBC, a java.lang.ClassNotFound exception is thrown at the point where the database driver should be loaded (eg when Class.forName is called for the appropriate database driver).
Suggested fixes
This typically occurs when the database driver is not on the classpath. There are two steps to fix this problem. First, download the driver for the database you wish to access (mysql, postgres, Oracle, Microsoft SQL). Second, place the downloaded jar file on the classpath of the program. Oracle provides detailed instructions for doing this on the command line. For those using Eclipse, right click the project and select Properties. Go to Java Build Path -> Libraries -> Add External Jar and select the driver jar.