AdvancedBan icon indicating copy to clipboard operation
AdvancedBan copied to clipboard

Remove Class.forName in DynamicDataSource

Open A248 opened this issue 5 years ago • 0 comments

This is an antiquated approach to ensure a JDBC driver is loaded, which somehow stubbornly persists to this day. Since Java 6, the ServiceLoader mechanism is used to load java.sql.Driver implementations. The JDBC url is therefore sufficient to load Drivers.

Only very, very old JDBC drivers which are not JDBC 4.0-compliant will not have a ServiceLoader file. Fortunately, Connector-J introduced support in 5.1.3, way back in 2007.

This means the Class.forName call can be safely removed from DynamicDataSource

A248 avatar Nov 12 '20 01:11 A248