Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC Connection Interface  RSS feed

 
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
Boost this thread!