• Post Reply Bookmark Topic Watch Topic
  • New Topic

about class.forName  RSS feed

 
srinivas nageli
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am new to java.we are using class.forName() for loading classes.i have one doubt in this topic, this function we are using in jdbc for load the class and getting connection here we are just loading the class what's happening on loading time.if we need to do anything on loading time we should implement static block, are they using static block on sun.jdbc.odbc.jdbcodbcdriver class please anyone give the clarification and help me.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Welcome to JavaRanch!

Yes, the convention is that a driver class uses a static block to call DriverManager.registerDriver() with an instance of itself, so that by loading the class, you automatically install the driver.
 
srinivas nageli
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ernest Friedman,
Thanks for your reply.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!