File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Interfaces 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 "Interfaces" Watch "Interfaces" New topic


siddu banjapally

Joined: Aug 16, 2011
Posts: 13

hello everyone,

I am working with JDBC program.when i come across code, I got some doubts.

that is, we can not create object for interfaces, then in JDBC connection, statement,etc having objects in program.

how can it possible?

thank you
Tina Smith
Ranch Hand

Joined: Jul 21, 2011
Posts: 208

Do you have an example of something that you don't understand?

Interfaces are (and I use that loosely) objects. I like to think of them as another way of looking at an object, in terms of what it does. An interface describes the behaviour contract of an underlying object. Any object that can fill this contract can be used.
Example is ResultSet; you know that there is an object there and that you can call the next() method to get a result. The only thing you don't know is the name of the class that is responsible for providing the result returned by next().

Everything is theoretically impossible, until it is done. ~Robert A. Heinlein
siddu banjapally

Joined: Aug 16, 2011
Posts: 13

Connetion con=DriverManager.getConnection(,,);
Statement stmt=con.createStatement();

In the above code, Statement is a interface, so we can create only reference, not object and there con is a connection interface object.

how they create the objects for them and accessing the variables?
I agree. Here's the link:
subject: Interfaces
jQuery in Action, 3rd edition