Name

Driver

Synopsis

Class Name: java.sql.Driver
Superclass: None
Immediate Subclasses: None
Interfaces Implemented: None
Availability: JDK 1.1

Description

This class represents a specific JDBC implementation. When a Driver is loaded, it should create an instance of itself and register that instance with the DriverManager class. This allows applications to create instances of it using the Class.forName() call to load a driver.

The Driver object then provides the ability for an application to connect to one or more databases. When a request for a specific database comes through, the DriverManager will pass the data source request to each Driver registered as a URL. The first Driver to connect to the data source using that URL will be used.

Class Summary

public interface Driver {
    boolean acceptsURL(String url) throws SQLException;
    Connection connect(String url, Properties info)
        throws SQLException;
    int getMajorVersion();
    int getMinorVersion();
    DriverPropertyInfo[] getPropertyInfo(String url, 
                                         Properties info)
        throws SQLException;
    boolean jdbcCompliant();
}

Object Methods

acceptsURL( )
public boolean acceptsURL(String url) throws SQLException

Description: Returns true if the specified URL matches the URL subprotocol used by this driver.

connect( )
public Connection connect(String url, Properties info) 
    throws SQLException

Description: This method attempts a connect using the specified URL and Property information (usually containing the user name and password). If the URL is not right for this driver, ...

Get MySQL and mSQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.