• Post Reply Bookmark Topic Watch Topic
  • New Topic

why connection is a interface

 
firoz silar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why all these are interface in java.sql package.

java.sql.Connection
java.sql.DatabaseMetaData
java.sql.ParameterMetaData
java.sql.ResultSet
java.sql.ResultSetMetaData
java.sql.Statement
java.sql.PreparedStatement
java.sql.CallableStatement
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36016
425
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firoz,
Welcome to JavaRanch!

All of those classes are interfaces so you can use them with different databases. Database vendors supply a driver containing classes that implement the interfaces. Then if you want to switch databases, you switch the driver and can leave the code alone.

For specifics about any one of the interfaces, take a look at the JavaDoc

[I deleted your accidental duplicate thread for you]
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!