File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes which concrete class has the implementation for createStatement method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "which concrete class has the implementation for createStatement method" Watch "which concrete class has the implementation for createStatement method" New topic
Author

which concrete class has the implementation for createStatement method

sudheer kiran
Ranch Hand

Joined: Jun 26, 2008
Posts: 237



where is the implementation of createStatement method.
Connection is also an interface.
DriverManager returns a Connection Object.but how do we know Which concrete connection object that is


Sudheer
SCWCD, SCJP 5
Ulrika Tingle
Ranch Hand

Joined: Nov 24, 2009
Posts: 92
sudheer kiran wrote:but how do we know Which concrete connection object that is


The idea is that you don't need to know and that makes your code more general and flexible.

Connection and Statement are interfaces. When you write your code using variables of an interface your code will work with any object implementing that interface. Otherwise your code would be tied down to work with objects of one concrete class only.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

sudheer kiran wrote:DriverManager returns a Connection Object.but how do we know Which concrete connection object that is

That depends on the JDBC driver that you are using - it's a class that the JDBC driver provides. You're not supposed to know in your Java application, because you don't want to make your application dependent on one specific JDBC driver. If you really want to know, you can find out like this:


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: which concrete class has the implementation for createStatement method
 
Similar Threads
JDBC
Regarding createStatement();
interface method definition?
How to use the connection object defined in another class from the Main class
import java.sql