Understanding JDBC Internal Components

[1] In JDBC, why should we load drivers first using Class.forName ("some driver name"). Why SUN did not take care of loading the driver in the getConnection () method itself. If you pass the driver name as a parameter to the getConnection () method.

[2] I want to understand the insides of the JBDC. All landmarks are appreciated.

+3
source share
3 answers

With JDBC 4, you will no longer need to use Class.forName (...) see here for one article explaining this:

, JDBC. JDBC Class.forName(), , JDBC. DriverManager JDBC . , DriverManager registerDriver() . , jdbc.drivers. DriverManager , , .

JDBC 4 J2SE Service Provider, . JAR META-INF/services/java.sql.driver. JDBC . getConnection() DriverManager , , . , registerDriver(), .

Sun JDBC JDBC. JDBC 4.0 ...

+8

java.sql , , JDBC. , jar JDBC- META-INF/. , , .

JDBC . src.zip JDK. DriverManager - .

+1

. JDBC 4.0 , J2SE. , JDBC , . , JDBC, JDBC 4.0. . DriverManager , URL- JDBC, DriverManager.getConnection(). , , , , DriverManager . DriverManager.setLogStream() DriverManager.setLogWriter() .

This is one of the JDBC 4.0 drivers that I know: http://www.inetsoftware.de/products/jdbc/mssql/merlia

0
source

Source: https://habr.com/ru/post/1699221/


All Articles