This could possibly go into the beginner section, but since I'm just learning JDBC I figure I'll post it here.
There's a line of code that says
Now, what that looked like to me was a Static Method being called from the Class class.
So I went to the API for Class and found that Class.forName()
Returns the Class object associated with the class or interface with the given string name.
So that means that it returns the class object associated with the given String name, which in this case is the String driver, and then calls newIntance(); on the Class object that was returned from the forName(method).
The problem is, is that I have absolutely no idea what this is for (and the API didn't really explain it), and at no point in the code (attached link) does it seem to do anything.
Would someone be kind enough to explain it me or point me in the right direction towards something that will?
I apologize ahead of time if it needs to be move, and thanks ahead of time for all of those who help.
source code [ February 03, 2006: Message edited by: Nicholas Carrier ]
Teaching yourself anything is always the cheapest way, but it definitely takes a lot of time and effort.<br /> <br />Thank you javaranch <a href="http://"http://faq.javaranch.com/view?HowToAskQuestionsOnJavaRanch"" target="_blank" rel="nofollow">Learn How to Ask Your Question</a> and be nice
A proper JDBC driver always has a static initialization section, invoked when the class is loaded, that causes the driver to call DriverManager.registerDriver().
Then later, when DriverManager.getConnection() is called, it will iterate through all the loaded drivers, asking them (Driver).acceptsURL() ?, until it finds one that does, or exhausts the lists of drivers.