Let me state up front that I'm biased in favor of using "Class.forName()". But either way works equally well. In the JavaDoc for the java.sql.Driver class it states:
When a Driver class is loaded, it should create an instance of itself and register it with the DriverManager. This means that a user can load and register a driver by calling
Class.forName("foo.bah.Driver")
Most driver classes accomplish this by having a "static { ... }" block of code that creates an instance and calls "DriverManger.registerDriver()" on that instance.
So if you use "DriverManager.registerDriver(new foo.bar.Driver())" in your code here's what happens:
the "foo.bar.Driver" class is loaded a new instance of "foo.bar.Driver" is created in the "static { ... }" initializer of the "someDriver" class that new instance is registered with DriverManager your code creates a second instance of "foo.bar.Driver" the second instance is registered with DriverManager The upshot is that TWO instances of "foo.bar.Driver" are created. If you use the "Class.forName()" method only ONE instance of "foo.bar.Driver" is created.
[ December 05, 2003: Message edited by: Wayne L Johnson ]