Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC Interfaces

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are using interfaces like Connection, ResultSet ... and so on. But we are not impleting the interfaces or we are not also implementing all the methods in interfaces. How it is possible?If any one can explain me please do it.
- Sekar
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the Connection object is returned by the DriverManager class which in turn returns the Connection object from the Driver interface using the Driver.connect method.Therefore it is a possibility that the respective driver classes for each driver implements these methods in their class files. But i am not sure because these respective java files are not available.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya, like i told you previously, you have different driver class implementations for different databses ex mssqlserver etc. if you have the weblogic driver classes, you can see there are different class files for
all of these interfaces like PreparedStatement, Connection etc.
so all of these interfaces have their respective implementations for each driver. That is why it is platform independent.
you can write a driver and implement all of these interfaces to from a new driver. Hope you understood!!! if you still have any doubts post your new message again.
 
Milind Kulkarni
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
All the mentioned interfaces are implemented in the driver classes. It is the responsibility of Driver Writers to implement all the methods in the interfaces contained in the JDBC 1.0 API so that they support at least ANSI SQL-92 Entry level.
The following interfaces must be fully implemented:
java.sql.Driver
java.sql.DatabaseMetaData
java.sql.ResultSetMetaData
The following interfaces must be implemented but some of the methods are optional:
java.sql.CallableStatement
java.sql.Connection
java.sql.PreparedStatement
java.sql.ResultSet
java.sql.Statement

The following interfaces are optional (may be omitted) if a driver cannot support them:
java.sql.Array
java.sql.Blob
etc.
Regards,
Milind
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic