How to create Connection interface object because it is
Interface , Interface is not instansiated?

Answer Posted / anand

We can not create object to any interface but we can create a reference variable to interface. Connection is an interface released by SUN micro system.Once interface released anybody in this world can provide implementation,provide implementation means writing down the code for all the methods of that inteface. As we know that Connection is an interface relased by sun micro system and Oracle corporation provide implementation class to that inteface and this class is called "Connetion class".We can create the reference variable to Connection interface and this reference variable hold the object of class which provide the implementation to Connection class.
DriverManager is also an interface and this interface contains a static method getConnection(), this method returns the object of a class which provide implementation of Connection interface.

Is This Answer Correct ?    0 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is not bound in this context unable to find jdbc spring boot?

497


What does connection pooling mean ?

579


How we store procedure in oralce for callable statements in jdbc

1854


What is JDBC Batch Processing and what are it’s benefits?

514


What is jdbc and jdbc drivers?

508






How to achieve JDBC Connection Pooling using JDBC DataSource and JNDI in Apache Tomcat Server?

534


What is odbc and jdbc?

489


Explain how data flows from view to db and reverse

1640


Why prepared statements are faster?

533


What is odbc jdbc?

539


What are the different types of drivers under jdbc?

477


What is the meaning of connection?

533


Does jdbctemplate close connection?

503


Explain some new features available in jdbc 4.0?

615


What are the common tasks of JDBC?

572