Well the important thing about forName() method of Class is that it basically loads the driver.
Now, what do we mean by loading the driver?
It basically takes the class name passed as the string and it executes the static blocks of that particular class.
Now these static block have the code that is needed for making Driver Manager aware of the fact that there is one more driver been added to the list of the available drivers.Hence when are request for that particular driver is made, it is available for the Driver Manager.
Whats interested to notice is the fact that forName() does not create an instance of the class passed as string parameter.It basically executes the static part of a class.
No comments:
Post a Comment