• Post Reply Bookmark Topic Watch Topic
  • New Topic

Class.forName()  RSS feed

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the significance of the code Class.forName() while doing a connection?

Thanks,
aakash
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Class.forName() will try to load the class that you specified as string argument. If the class that you specified cannot be found in the classpath, Class.forName() will throw a ClassNotFoundException.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm thinking that you're curious about the significance of this code in the context of JDBC. So, I'm moving this to the JDBC forum...
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It registers the JDBC driver. Check the API docs for java.sql.Driver and/or java.sql.DriverManager for more info.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!