I'm new to Java development, and I was happy to see how easy the implementation of the database was, compared to the platforms. I am used in PHP environment.
However, I'm confused about one thing - I read everywhere I have to do a runtime-to use the included database driver I want to use, i.e.:
class. ForName (com.example.jdbc.Driver) .newInstance ();
However, omitting it also works fine - so my question is, does the JDBC driver find, given to the server URL, automatically? And if so, then why has this line been read in all the tutorials on this subject?
In addition - if anyone has got good tips for learning online resources (especially enterprise development), please share!
Yes, it has improved in JDK 6. See.
Specifically:
In JDBC 4.0, we do not need to explicitly load the JDBC drivers from the class.FireNname (). When the method is called a connection, then DriverManager will attempt to detect one of the JDBC drivers that were initially loaded and that the use of the same class loader as the current application is clearly loaded. .
See also in JDK 6.
Comments
Post a Comment