O'Reilly logo

Database Programming with JDBC & Java, Second Edition by George Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Driver

Synopsis

Interface 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 action 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 passes 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

This method 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 username and password). If the URL is not right ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required