Hello, explain the following:
why you need to prescribe Class.forName("com.mysql.fabric.jdbc.Driver"); ? After all, it says link

If you are using Java 5, you need to load the driver class before attempting to connect.

Class.forName ("com.mysql.fabric.jdbc.Driver");

But I have 8, what's wrong?

    1 answer 1

    It does not depend on the Java version, but on JDBC. In JDBC 4.0, autoloading of the DBMS driver via the Service Provider (SPM) mechanism appeared.

    When you request a connection, DriverManager scans the classpath via the ServiceLoader and searches for META-INF/services/java.sql.Driver DriverManager files, and then loads all the classes listed in them. For example, the contents of this file in the MySQL driver:

    META-INF / services / java.sql.Driver

     com.mysql.jdbc.Driver com.mysql.fabric.jdbc.FabricMySQLDriver 

    In order not to rely on SPM support for a specific driver, you can register it manually through Class.forName() .

    The MySQL 3.xx driver version does not support SPM, i.e. driver must be loaded manually.