What does forName() method in the Class class do, when loading jdbc:odbc driver?
问题 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. 回答1: Class.forName() causes ClassLoader to load the class into memory. JDBC driver classes have static initializers that register them with DriverManager for