Q1) How to create an object of Connection Interface?
Please correct if i am wrong?
1) Interface cannot be instantiated.So we can create a class that implements the interface then create the object of the connection interface.
Q2) I don't understand how DriverManager.getConnection() creates connection object.DriverManager class is not implenenting the Connection interface in API.
Then how the DriverManger class is creating the object?
Q3) If we want create object we normally create class that implements the interface then create the object but How DriverManager class API is creating the object
without implementing the connection Interface?
amolpalekar kadolkar wrote:Q3) If we want create object we normally create class that implements the interface then create the object but How DriverManager class API is creating the object without implementing the connection Interface?
No. DriverManager returns an instance of a class which does implement the Connection interface. That's all it does. (The class already exists, and it's in the JDBC driver jar.) So asking how it does something else isn't a very useful question (especially since you seem to be claiming it does something which it doesn't actually do, and asking how it does that).
he classes java.lang.System and java.sql.DriverManager are examples of the Singleton pattern,
although they are not implemented using the approach recommended in the GoF book but with static methods...
VIJINDAS
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: How can we create object of Connection Interface.