35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
|
|
|
38 |
package java.sql; |
package java.sql; |
39 |
|
|
40 |
import java.util.Properties; |
import java.util.Properties; |
53 |
* |
* |
54 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @author Aaron M. Renn (arenn@urbanophile.com) |
55 |
*/ |
*/ |
56 |
public interface Driver |
public interface Driver |
57 |
{ |
{ |
58 |
|
/** |
59 |
/** |
* This method connects to the specified database using the connection |
60 |
* This method returns the major version number of the driver. |
* properties supplied. If the driver does not understand the database |
61 |
* |
* URL, it should return <code>null</code> instead of throwing an |
62 |
* @return The major version number of the driver. |
* exception since the <code>DriverManager</code> will probe a driver |
63 |
*/ |
* in this manner. |
64 |
public abstract int |
* |
65 |
getMajorVersion(); |
* @param url The URL string for this connection. |
66 |
|
* @param properties The list of database connection properties. |
67 |
/*************************************************************************/ |
* @return A <code>Connection</code> object for the newly established |
68 |
|
* connection, or <code>null</code> if the URL is not understood. |
69 |
/** |
* @exception SQLException If an error occurs. |
70 |
* This method returns the minor version number of the driver. |
*/ |
71 |
* |
public Connection connect(String url, Properties info) throws SQLException; |
72 |
* @return The minor version number of the driver. |
|
73 |
*/ |
/** |
74 |
public abstract int |
* This method tests whether or not the driver believes it can connect to |
75 |
getMinorVersion(); |
* the specified database. The driver should only test whether it |
76 |
|
* understands and accepts the URL. It should not necessarily attempt to |
77 |
/*************************************************************************/ |
* probe the database for a connection. |
78 |
|
* |
79 |
/** |
* @param The database URL string. |
80 |
* This method tests whether or not the driver is JDBC compliant. This |
* @return <code>true</code> if the drivers can connect to the database, |
81 |
* method should only return <code>true</code> if the driver has been |
* <code>false</code> otherwise. |
82 |
* certified as JDBC compliant. |
* @exception SQLException If an error occurs. |
83 |
* |
*/ |
84 |
* @return <code>true</code> if the driver has been certified JDBC compliant, |
public boolean acceptsURL(String url) throws SQLException; |
85 |
* <code>false</code> otherwise. |
|
86 |
*/ |
/** |
87 |
public abstract boolean |
* This method returns an array of possible properties that could be |
88 |
jdbcCompliant(); |
* used to connect to the specified database. |
89 |
|
* |
90 |
/*************************************************************************/ |
* @param url The URL string of the database to connect to. |
91 |
|
* @param properties The list of properties the caller is planning to use |
92 |
/** |
* to connect to the database. |
93 |
* This method returns an array of possible properties that could be |
* @return A list of possible additional properties for a connection to this |
94 |
* used to connect to the specified database. |
* database. This list may be empty. |
95 |
* |
* @exception SQLException If an error occurs. |
96 |
* @param url The URL string of the database to connect to. |
*/ |
97 |
* @param properties The list of properties the caller is planning to use |
public DriverPropertyInfo[] getPropertyInfo(String url, Properties properties) |
98 |
* to connect to the database. |
throws SQLException; |
99 |
* |
|
100 |
* @return A list of possible additional properties for a connection to this |
/** |
101 |
* database. This list may be empty. |
* This method returns the major version number of the driver. |
102 |
* |
* |
103 |
* @exception SQLException If an error occurs. |
* @return The major version number of the driver. |
104 |
*/ |
*/ |
105 |
public abstract DriverPropertyInfo[] |
public int getMajorVersion(); |
106 |
getPropertyInfo(String url, Properties properties) throws SQLException; |
|
107 |
|
/** |
108 |
/*************************************************************************/ |
* This method returns the minor version number of the driver. |
109 |
|
* |
110 |
/** |
* @return The minor version number of the driver. |
111 |
* This method tests whether or not the driver believes it can connect to |
*/ |
112 |
* the specified database. The driver should only test whether it |
public int getMinorVersion(); |
113 |
* understands and accepts the URL. It should not necessarily attempt to |
|
114 |
* probe the database for a connection. |
/** |
115 |
* |
* This method tests whether or not the driver is JDBC compliant. This |
116 |
* @param The database URL string. |
* method should only return <code>true</code> if the driver has been |
117 |
* |
* certified as JDBC compliant. |
118 |
* @return <code>true</code> if the drivers can connect to the database, |
* |
119 |
* <code>false</code> otherwise. |
* @return <code>true</code> if the driver has been certified JDBC compliant, |
120 |
* |
* <code>false</code> otherwise. |
121 |
* @exception SQLException If an error occurs. |
*/ |
122 |
*/ |
public boolean jdbcCompliant(); |
123 |
public abstract boolean |
} |
|
acceptsURL(String url) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method connects to the specified database using the connection |
|
|
* properties supplied. If the driver does not understand the database |
|
|
* URL, it should return <code>null</code> instead of throwing an |
|
|
* exception since the <code>DriverManager</code> will probe a driver |
|
|
* in this manner. |
|
|
* |
|
|
* @param url The URL string for this connection. |
|
|
* @param properties The list of database connection properties. |
|
|
* |
|
|
* @return A <code>Connection</code> object for the newly established |
|
|
* connection, or <code>null</code> if the URL is not understood. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract Connection |
|
|
connect(String url, Properties properties) throws SQLException; |
|
|
|
|
|
} // interface Driver |
|
|
|
|