This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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
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
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).]