• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic