![]() |
VOOZH | about |
The Driver interface in JDBC is a core interface that enables Java applications to communicate with databases. It acts as a bridge between the application and the database by handling connection requests and translating them into database-specific operations.
The working of the Driver interface follows a structured flow:
1. connect(): Establishes a connection to the database.
Connection connect(String url, Properties info) throws SQLException;
2. acceptsURL(): Checks whether the driver can handle the given JDBC URL.
boolean acceptsURL(String url) throws SQLException;
3. getPropertyInfo(): Provides information about connection properties.
DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException;
4. getMajorVersion() and getMinorVersion(): Returns driver version details.
5. jdbcCompliant(): Checks whether the driver follows JDBC standards.
Example: Using DriverManager with Driver Interface
Explanation: