Creativity is nothing but Breaking Rules
why it is so like that even thoudh the implementation is in jar files we have not mentioned any where in our code..
but still we are using sql package only please tell me with example
Creativity is nothing but Breaking Rules
ok balu but when we call createStatement() method from our class.is it so JVM will call the data base vendor class or while implementing the interfaces they had writtenn the code like that... tell me please
how do you call createStatement() ? using which object ?
Creativity is nothing but Breaking Rules
using which object ? how did you get that object ?
first we will create reference of type connection and then we will call CreateStatement() method which will return statement
which object ?
Creativity is nothing but Breaking Rules
here we cant create instance of interface connection .thats why we are creating only references.please guide me
SCJP (1.4),SCWCD
the object of Database vendor Connection object ( through polymorphism).
Creativity is nothing but Breaking Rules
1> First you load the drivers i.e. Class.forName("class name here from the .jar file");
When this statement gets executed it will actually create a object of the Driver class (implementation from the jar file)
In the Driver class implementation if you see the default constructor implementation it actually calls the DriverManager.register() method which actually registers this driver class with the DriverManager.
SCJP (1.4),SCWCD
santhosh.R gowda wrote:
the object of Database vendor Connection object ( through polymorphism).
as you told connection object of data base vendor is called ... there in my code i had not written any import statement of vendor classes just i had put them in classfiles thats all.in my code i had written import java.sql.*; means all interfaces in sql will come into my class ok. when i type this statement class.forName(); Driver of the corresponding DB will be loaded into my class .and when i type statement Driver manager.getConnection() ; getConnection is a static method in Drivermanager which is in sql package. which gets connectd to a DB and returns connection . in next statement i will Connection .createStatement() this connection object is data base vendor object right. using this i will call create statement which will returns statement object ok. is it so like that
Creativity is nothing but Breaking Rules
Atul Jawale wrote:Hi Balu , Can you please tell me what is the differenece between loading the class in JVM and creating the object ?
Hi Balu , Can you please tell me what is the differenece between loading the class in JVM and creating the object
Creativity is nothing but Breaking Rules
Water! People swim in water! Even tiny ads swim in water:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|