| Author |
Internally what happens when Class.forName() is executed
|
Praveen palukuri
Ranch Hand
Joined: Feb 10, 2005
Posts: 65
|
|
hi, i know that Class.forName(...) loads driver if it is not loaded earlier. Shall any one explain what is the internal process going on when it is executed. Thank YOu,
|
 |
Annie Smith
Ranch Hand
Joined: Mar 05, 2005
Posts: 172
|
|
|
I'm not sure how deep do you want to know. Go through the API, the JLS or finally take a look at the source code.
|
Cheers!<br /><b>Annie</b>
|
 |
purushottaman dwarkanathan
Greenhorn
Joined: Apr 26, 2005
Posts: 25
|
|
Basically after the Class.forName() internally DriverManager.registerDriver() is called. This will look for the appropriate driver and registers it. The DriverManager class will maintain a list of the registered drivers. I hope this helps. Thanks, Purushottaman
|
IBM Certified SOA Associate
|
 |
Sirish Kumar Gongal Reddy
Ranch Hand
Joined: Oct 25, 2004
Posts: 109
|
|
Hi, 1)What you said previously about Class.forName() is exactly correct.if come to the internals Class.forName won't create any memory for your driver(note that it won't create memory for your driver only for entair object it can) at the time your instantiation.when you are trying to use that driver then only it will create memory.So that we can use memory efficiently. 2)Generally Class.forName() takes String as a argument insted of passing your correct driver you can pass any string variable as a argument so that it won't take care about what you are passing at compile time when you try to run that program it will raise an runtime exception. Hope that you got my point. Regards, G Sirish Reddy.,
|
 |
 |
|
|
subject: Internally what happens when Class.forName() is executed
|
|
|