What does forName() method in the Class class do, when loading jdbc:odbc driver?
database, driver, java, jdbc, odbc
Solution
`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.
Problem
I am learning to enable my Java application to communicate with a 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? Thank you very much.