aspose file tools*
The moose likes JDBC and the fly likes CreateStatement() belongs to which class ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "CreateStatement() belongs to which class ???" Watch "CreateStatement() belongs to which class ???" New topic
Author

CreateStatement() belongs to which class ???

Deepika Wadhwa
Ranch Hand

Joined: Aug 05, 2000
Posts: 57
Hi all,
i am having a basic doubt that we always create statement objects using objects of Connection type.
but Connection itself is interface , so where can we find definition for CreateStatement() method.
thanx in advance,
Deepika
------------------
ds
Prasad Charasala
Ranch Hand

Joined: Nov 02, 2000
Posts: 67
Hi Deepika,
Not only the Connection, Statement, PreparedStatement are all interfaces only. The only class that implements the methods is DriverManager. The actual implementation will be in the DriverManager class. If strictly speak the implementation will be in the vendor specific driver. Suppose if you are using com.oracle.OracleDriver, the implementation is there actually.
That is the beauty of JAVA. Interfaces are just agrrements between our code and vendor writen code.
I think this answered your question.
------------------
Prasad


<B>Prasad</B>
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Right. The vendor will supply some class that implements the java.sql interfaces. Let's make a pretend scenario for a database called TomBase which is JDBC compliant. TomBase will supply you with a driver that you would load. You will then ask for a Connection object from the TomBase driver. The driver generates a TomConnection object which implements java.sql.Connection. When you ask to get a Statement object from the TomConnection object, it will instantiate a TomStatement which implements Statement and so on. So you see only the interface... the actual implementation is hidden from you.
[This message has been edited by Thomas Paul (edited November 03, 2000).]


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Deepika Wadhwa
Ranch Hand

Joined: Aug 05, 2000
Posts: 57
thanx Tom and Prasad , for your appropriate answers.
thanx a lot
Deepika
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CreateStatement() belongs to which class ???