The Driver interface defines the methods that must be implemented by JDBC drivers. Each driver should supply a class that implements the Driver interface. The interface contains methods like connect() and getConnection() that are used to build connections between a URL and a database. The connect() method attempts to make a database connection to a given URL and should return null if it is not the right driver or throw an exception if there is a problem connecting.
3. • This interface is used to define the methods
which must be implemented by JDBC Driver
4. • The interface that every driver class must
implement.
• Each driver should supply a class that
implements the Driver interface.
5. Connect()
• Connection connect(String url, Properties info) throws
SQLException
• Attempts 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 driver manager is asked to
connect to a given URL it passes the URL to each loaded
driver in turn.The driver should throw an SQLException 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.
Normally at least "user" and "password" properties should
be included in theProperties object.
6. getConnection ( )
• Driver.getConnection ( ) :
• This is used to built connection between url and database.
• In case there is an exception in try block, the subsequent catch block
caught and handle the exception, The exception show you no suitable
driver is found.