I am learning to enable my Java application to communicate with an MS Access database.
I am unsure of one method, the Class.forName() method. The parameter I pass is "sun.jdbc.odbc.JdbcOdbcDriver", which loads the jdbc:odbc bridge for accessing a database.
What does the Class.forName() do exactly and why is it needed?
Class.forName() causes ClassLoader to load the class into memory. JDBC driver classes have static initializers that register them with DriverManager for further use. After you use Class.forName(), and use DriverManager.getConnection("jdbc:*", database, username, password), the jdbc: is already loaded in memory.