• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Query on Connection interface

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While writing database programs we use interfaces such as Connection, Statement etc.
But our class does not implement these interfaces.
Why is it so???
For example:
class xyz
{
Connection con = DriverManger.getConnection();
Statement stmt = con.createStatement()
.....
}
Here our class does not implement Connection as well as Statement interfaces

It will be very helpfull if someone gives us the reasons.
Thanks in advance.
 
Ranch Hand
Posts: 128
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see is that, you dont implement the sql interfaces is that you get a Default Implementation from the Vendor who owns the Database to which you are coding for, or the Default implementation if using ODBC Data Sources.

Simply because there is not standard as to how a Database Application provides a non SQL interface to other Systems / Languages...so sun has atleast Standardized the interface that a java Programmer has to program to, to access the Database so that your code remains Database independent.

you could still implement the connection Class, but then that would mean you will be implementing the whole set of interfaces as all the interfaces are hirarchically linked...(that is, you get a Statement Object from a connection Object, a ResultSet Object from a Statement etc). You should be knowing The database you are intending to write the driver inside out, because it also involves calling native methods on the Database Side.

Hope this is attempting to answer your point.
 
reply
    Bookmark Topic Watch Topic
  • New Topic