Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC Connection Interface

 
shyam java developer
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why in JDBC Connection is interface?
 
Vijay Tidake
Ranch Hand
Posts: 148
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Its because of each DB is vendor specific.So the class that provides you a connection object implements the Connection interface(Polymorphism).

Connection con=DriverManager.getConnection(<params>);

DriverManager.getConnection(<params>); return the object of a class(the name of a class does not matter) that implements the Connection interface

Hope this helps
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic