• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlets

 
ml behra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys!!!
I have a basic doubt.
DriverManager is a class then why is not instantiated as other classes.
For example we usually give as
Connection con=DriverManager.getConnection("jdbc.odbc.dsn","username","password");
Why don't we give as
DriverManager dm=new DriverManager(...)
waiting for reply
Thanks in advance.
 
Milind Mahajan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
getConnection() method is a static method in DriverManager class. So, you don't need to instantiate it, to call the method.
There are no visible constructors in DriverManager class. So, you cannot create an instance of it. I guess it is similar to Math class.
Hope this helps.
Milind
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic