This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC 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
Bookmark "JDBC" Watch "JDBC" New topic


Vandiyadevan senthan
Ranch Hand

Joined: Nov 11, 2003
Posts: 37
Dear All,

I am a having one doubt while making a connection to a database.

// Variables or reference
Connection con=null;
Statement stmt=null;
ResultSet rs=null;

//Db connection
con=DriverManager.getConnection("jdbc dbc:abc");
rs=stmt.executeQuery("Select * from <table>");


In this,Connection,Statement and resultset are all interfaces.And moreover,the methods such as createStatement(),executeQuery() are all empty only in Connection Interface and Statement Interface respectively.

Being a method which is defined in interfaces are empty or abstract by default,

if that is the case ,How can we use these here.

Where and all the implementation of these methods..

Pls explain these....

Warm Regards,
Rajasekar Elango
Ranch Hand

Joined: Sep 13, 2004
Posts: 105
Hi Senthan,

Implementation's for these interface are found in runtime library (rt.jar in jre/lib).

essentialy loads this library.

This is beauty of programing to interface. This way your code is independent of database. you can substitude with driver for any database.


SCJP 1.4
It is sorta covered in the JavaRanch Style Guide.
subject: JDBC