Why does Service.providers(java.sql.Driver.class) can always get mysql's driver? p -
i'm testing proxool connection pool (the db mysql), , find curious case, mysql's driver can registered drivermanager though don't explicitly invoke
class.forname("com.mysql.jdbc.driver") while proxool's driver cann't. , jdk code , find clue, that
service.providers(java.sql.driver.class) can mysql's driver while cann't proxools. maybe reason. , question why method can automatically find mysql's driver?
the following testing code:
public static void main(string[] args) throws exception{ iterator drivers = service.providers(java.sql.driver.class); while(it.hasnext()){ system.out.println(it.next()); } } and result is:
sun.jdbc.odbc.jdbcodbcdriver@31d520c4 com.mysql.jdbc.driver@1f5a3d6b
Comments
Post a Comment