• Post Reply Bookmark Topic Watch Topic
  • New Topic

why connection is a interface  RSS feed

 
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
Marshal
Posts: 36656
475
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]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!