类 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 interface

    The 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

        public NonRegisteringDriver()
                             throws SQLException
        Construct 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 to
        info - 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 is null
      • jdbcCompliant

        public boolean jdbcCompliant()
        指定者:
        jdbcCompliant 在接口中 Driver