Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Implementation of methods of Result Set

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends
Could u tell me as all the methods of the ResultSet interface is abstract but we use them like next() getString(String),getMetaData() etc.
and they works HOW??? Where they are implemented ie which is the subclass
of the ResultSet plus also for Statement,PreparedStatement and Connection interfaces ....

Thanks
GAUTAM
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do any calls to an interface work? At runtime the method is called on a class which implements the interface. And that class will be part of the driver supplied by the database vendor.
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is where the Database Drivers comes into place.

Now all database should support common operations of executing a query, trversion through the resultset, reading each column in a result, getting a connection,closing a connection ...etc.

So these standard operations are made as interface methods by Java.

Now the vendors who provide database drivers, implement this interface and hence they have to write their own implementation for each methods.

Say Oracle database driver will have its own logic/code of executing a query.

an SQL Server database driver will have its own logic/code for the same purpose.
Since both implement the Statement interface, we the developers need not worry what method to call if its a oracle driver or sql server driver.

we just call the method in the interface, and based upon the driver that is loaded, those methods are called and executed.

In that way, Java allows any database vendor to write their drivers but all drivers will be in a standard way ,without confusing the developer.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gautam,

The topic of this Forum is "Servlets".

Your question would probably get better responses in the Java In General (Beginner) forum.
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, I think the JDBC forum might be better.

I am moving this thread to the JDBC forum.

Mark
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic