• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what the Class.forName doing exactly.

 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all

Class.forName("xxx")
load the class file xxx. This is to load the driver class.

can i say that above class file xxx has the Class 'DriverManager' which is unique to each driver.
and also using that Class DriverManager i am able get the connection with the Database.


Am i right.

And also i confused where the class file will get loaded.

can any one help me?
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect the chief value of Class.forName(String fqpn) here is to load the driver class without creating an instance of it. The method uses a String, so the actual class doesn't have to be named until runtime, unlike the .class call, which is checked at compile-time.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...or you could look at this thread:
http://www.coderanch.com/t/302724/JDBC/java/Re-Class-forName
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic