• Post Reply Bookmark Topic Watch Topic
  • New Topic

loading of jdbc drivers  RSS feed

 
chowdaryv
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there are 2 methods to load jdbc drivers.
class.forname() and system.getproperties().
when exactly these are used in programming .
 
Milind Kulkarni
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
A Driver class should be implemented with a static section known as static initializer, that automatically does 2 things - (1) create an instance of itself and (2) register that instance by calling the method DriverManager.registerDriver(). When driver class includes this static section , the user can simply invoke the method Class.forName() supplying the name of the class, to load and register driver.
For Example - Following code loads and registers the Driver class.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
You can obtain properties of the driver using DatabaseMetaData object. System.getProperties() would get you the properties of the underlying system.
Regards,
Milind

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!