类 NonRegisteringDriver
- java.lang.Object
-
- com.mysql.cj.jdbc.NonRegisteringDriver
-
- 所有已实现的接口:
Driver
- 直接已知子类:
Driver
public class NonRegisteringDriver extends Object implements Driver
The Java SQL framework allows for multiple database drivers. Each driver should supply a class that implements the Driver interfaceThe DriverManager will try to load as many drivers as it can find and then for any given connection request, it will ask each driver in turn to try to connect to the target URL.
It is strongly recommended that each Driver class should be small and standalone so that the Driver class can be loaded and queried without bringing in vast quantities of supporting code.
When a Driver class is loaded, it should create an instance of itself and register it with the DriverManager. This means that a user can load and register a driver by doing Class.forName("foo.bah.Driver")
-
-
构造器概要
构造器 构造器 说明 NonRegisteringDriver()Construct a new driver and register it with DriverManager
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 booleanacceptsURL(String url)Typically, drivers will return true if they understand the subprotocol specified in the URL and false if they don't.Connectionconnect(String url, Properties info)Try to make a database connection to the given URL.intgetMajorVersion()intgetMinorVersion()static StringgetOSName()LoggergetParentLogger()static StringgetPlatform()DriverPropertyInfo[]getPropertyInfo(String url, Properties info)booleanjdbcCompliant()
-
-
-
构造器详细资料
-
NonRegisteringDriver
public NonRegisteringDriver() throws SQLExceptionConstruct a new driver and register it with DriverManager- 抛出:
SQLException- if a database error occurs.
-
-
方法详细资料
-
getOSName
public static String getOSName()
-
getPlatform
public static String getPlatform()
-
acceptsURL
public boolean acceptsURL(String url) throws SQLException
Typically, drivers will return true if they understand the subprotocol specified in the URL and false if they don't. This driver's protocols start with jdbc:mysql:- 指定者:
acceptsURL在接口中Driver- 参数:
url- the URL of the driver- 返回:
- true if this driver accepts the given URL
- 抛出:
SQLException- if a database access error occurs or the url is null
-
connect
public Connection connect(String url, Properties info) throws SQLException
Try to make a database connection to the given URL. The driver should return "null" if it realizes it is the wrong kind of driver to connect to the given URL. This will be common, as when the JDBC driverManager is asked to connect to a given URL, it passes the URL to each loaded driver in turn.The driver should raise an SQLException if the URL is null or if it is the right driver to connect to the given URL, but has trouble connecting to the database.
The java.util.Properties argument can be used to pass arbitrary string tag/value pairs as connection arguments. These properties take precedence over any properties sent in the URL.
MySQL protocol takes the form: jdbc:mysql://host:port/database
- 指定者:
connect在接口中Driver- 参数:
url- the URL of the database to connect toinfo- a list of arbitrary tag/value pairs as connection arguments- 返回:
- a connection to the URL or null if it isn't us
- 抛出:
SQLException- if a database access error occurs or the url isnull
-
getMajorVersion
public int getMajorVersion()
- 指定者:
getMajorVersion在接口中Driver
-
getMinorVersion
public int getMinorVersion()
- 指定者:
getMinorVersion在接口中Driver
-
getPropertyInfo
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
- 指定者:
getPropertyInfo在接口中Driver- 抛出:
SQLException
-
jdbcCompliant
public boolean jdbcCompliant()
- 指定者:
jdbcCompliant在接口中Driver
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- 指定者:
getParentLogger在接口中Driver- 抛出:
SQLFeatureNotSupportedException
-
-