my dog learned polymorphism
The moose likes JDBC and Relational Databases and the fly likes jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "jdbc" Watch "jdbc" New topic


vinoth ar

Joined: Jan 07, 2009
Posts: 21
i heard while reading... in jdbc that API will define interface and the driver has to implement that... what that exactly mean?? what is happening behind the scene... anyone explain in nice manner...'


Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
Simply that its like saying "hey if you want to be a JDBC Driver you have to talk my language" and this is obtained by forcing the vendor to implement specific interfaces defined by SUN. the same is for the Servlets.

i will give you a simple example suppose i want to force someone to specify an XML definition of his object contents, at this point i would implement an interface such like this one

now anyone who wants to speak my language should implement this interface and provide a definition for the "toXML()" method, at this point i don't care what type of definition he did, i just know that his class implements my interface and so i can call the toXML() method from the objects created using his class. (polymorphisim)

hope i helped you ;)


Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Each DB has its own way of obtaining a connection and doing several actions on it. The JDBC API provides a contract how to interact with DB using Java. It's intented to be DB independent. Each DB manfacturer could write its own JDBC API implementation for it so that one only need to replace the JDBC implementation (the JDBC driver) when one would switch from DB. No changes in JDBC code are needed then.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

vinoth ar, please be sure to take the time to compose descriptive subjects for your posts; read this for more information.

Using a title of "jdbc" in a forum completely dedicated to questions on JDBC isn't very helpful. This is the second topic you've started with this title. How are we to tell them apart? What if everyone named every topic in this forum "jdbc"?

Please go back and change your post to add a more meaningful subject by clicking the

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: jdbc
It's not a secret anymore!