• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Interface in JDBC (Interview Question)

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Friends,
I am confused that in JDBC , Connection, Statement, ResultSet etc are all Interfaces.
We all know that interfaces have ALL methods incomplete and the one who is implementing those interfaces should complete those methods.
Then how are we able to use :
Con.createStatement();
Stmt.executeQuery(Qry1);
Rs.next();
Where Con, Stmt and Rs are references of Connection, Statement and ResultSet respectively.
Who is implementing and completing these methods?
Thanks in advance.
Regards,
Milan Doshi.
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The provider of the JDBC driver is responsible for providing the methods that implement these interfaces. Different DBMS will implement them differently.
regarding
Con.createStatement();
where con is a Connection object
createStatement() method of the connection object creates an object that implements the statement interface.
The JDBC API has a better explanation.

Bosun
 
reply
    Bookmark Topic Watch Topic
  • New Topic