When the method getConnection is called,the DriverManager will
attempt to locate a suitable driver from among the JDBC drivers that
were loaded at initialization and those loaded explicitly using the
same class loader as the current application.
The DriverManager methods getConnection and getDrivers have been
enhanced to support the Java SE Service Provider mechanism (SPM).
According to SPM,a service is defined as a well-known set of
interfaces and abstract classes,and a service provider is a specific
implementation of a service. It also specifies that the service
provider configuration files are stored in the Meta-INF/services
directory. JDBC 4.0 drivers must include the file
Meta-INF/services/java.sql.Driver. This file contains the name of the
JDBC driver’s implementation of java.sql.Driver. For example,to load
the JDBC driver to connect to a Apache Derby database,the
Meta-INF/services/java.sql.Driver file would contain the following
entry:
最后
以上就是洁净电灯胆最近收集整理的关于如何在java中添加驱动程序,java – 驱动程序类如何位于JDBC4中的全部内容,更多相关如何在java中添加驱动程序,java内容请搜索靠谱客的其他文章。
发表评论 取消回复