• 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

Where is Connection interface implemented

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
We get a object of type Connection thru DriverManager.getConnection() method. But, where are the iplementation of this Connection inteface. I couldn't find any class/interface that implements/extends this Connecion interface
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi shankar,
JDBC API is mostly consisting of interfaces. So that most commonly used objects are the implementation of these interfaces. As u will see that Connection, Statement, PreparedStatement, CallableStatement, ResultSet, etc. are all interfaces. So who provides the implementation? The answer is that the JDBC driver is what provides the implementation of all these interfaces.
When you make a call as :-
DriverManager.getConnection("dbUrl", "username", "password");
The DriverManager class check out with all the registered drivers if they recognize the dbUrl. If any of the drivers recognizs the dbUrl, then the DriverManager uses that Driver class to get the Connection object. The Connection object in this case is the implementation of the Connection interface as provided by the driver. Similarly the implementation for all other interfaces like Statement, ResultSet etc are provided by the Driver.
Hope this clarifies your doubt.
-A/D.
 
Amol Deshmukh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi shankar,
JDBC API is mostly consisting of interfaces. So that most commonly used objects are the implementation of these interfaces. As u will see that Connection, Statement, PreparedStatement, CallableStatement, ResultSet, etc. are all interfaces. So who provides the implementation? The answer is that the JDBC driver is what provides the implementation of all these interfaces.
When you make a call as :-
DriverManager.getConnection("dbUrl", "username", "password");
The DriverManager class check out with all the registered drivers if they recognize the dbUrl. If any of the drivers recognizs the dbUrl, then the DriverManager uses that Driver class to get the Connection object. The Connection object in this case is the implementation of the Connection interface as provided by the driver. Similarly the implementation for all other interfaces like Statement, ResultSet etc are provided by the Driver.
Hope this clarifies your doubt.
Amol Deshmukh
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Amol Deshmukh,
Ya,I got it, Thanks. Sun provides just the set interfaces in the java.sql package and any third-pary people can implement it based on the spec, Right.
Now, I am looking a Tool which generates a Java file given a class file. I hope there are some Tool for this one. Please let me know i any.
Thanks
Shankar S
reply
    Bookmark Topic Watch Topic
  • New Topic