1

When programming java using netbeans IDE, if we add a jar file to that program, we can use its classes by using import class in the java file. But in the case of using oracle or mysql databases, why we are using the class.forname to load the library.

Thanks in advance.

Jeet
  • 1,006
  • 1
  • 14
  • 25

1 Answers1

0

You use reflection because you don't know which of the drivers will be available at runtime (mysql or oracle).

If you like you can still add those drivers to the compile classpath but that won't make much difference since you are interacting with them via the JDBC Api.

introex
  • 261
  • 1
  • 4