KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > rmijdbc > RJDriverInterface


1
2 /**
3  * RmiJdbc client/server JDBC Driver
4  * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997
5  *
6  * @version 1.0
7  * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com)
8  */

9
10 package org.objectweb.rmijdbc;
11
12 import java.sql.*;
13 import java.rmi.RemoteException JavaDoc;
14
15 /**
16  * <P>The Java SQL framework allows for multiple database drivers.
17  *
18  * <P>Each driver should supply a class that implements
19  * the Driver interface.
20  *
21  * <P>The DriverManager will try to load as many drivers as it can
22  * find and then for any given connection request, it will ask each
23  * driver in turn to try to connect to the target URL.
24  *
25  * <P>It is strongly recommended that each Driver class should be
26  * small and standalone so that the Driver class can be loaded and
27  * queried without bringing in vast quantities of supporting code.
28  *
29  * <P>When a Driver class is loaded, it should create an instance of
30  * itself and register it with the DriverManager. This means that a
31  * user can load and register a driver by doing
32  * Class.forName("foo.bah.Driver").
33  *
34  * @see DriverManager
35  * @see Connection
36  */

37 public interface RJDriverInterface extends java.rmi.Remote JavaDoc {
38
39   /**
40    * Administrative methods
41    */

42   void shutdown(String JavaDoc pwd) throws RemoteException JavaDoc;
43
44     /**
45      * Try to make a database connection to the given URL.
46      * The driver should return "null" if it realizes it is the wrong kind
47      * of driver to connect to the given URL. This will be common, as when
48      * the JDBC driver manager is asked to connect to a given URL it passes
49      * the URL to each loaded driver in turn.
50      *
51      * <P>The driver should raise a java.rmi.RemoteException if it is the right
52      * driver to connect to the given URL, but has trouble connecting to
53      * the database.
54      *
55      * <P>The java.util.Properties argument can be used to passed arbitrary
56      * string tag/value pairs as connection arguments.
57      * Normally at least "user" and "password" properties should be
58      * included in the Properties.
59      *
60      * @param url The URL of the database to connect to
61      *
62      * @param info a list of arbitrary string tag/value pairs as
63      * connection arguments; normally at least a "user" and
64      * "password" property should be included
65      *
66      * @return a Connection to the URL
67      */

68     RJConnectionInterface connect(String JavaDoc url, java.util.Properties JavaDoc info)
69     throws RemoteException JavaDoc, SQLException;
70
71     /**
72      * Returns true if the driver thinks that it can open a connection
73      * to the given URL. Typically drivers will return true if they
74      * understand the subprotocol specified in the URL and false if
75      * they don't.
76      *
77      * @param url The URL of the database.
78      * @return True if this driver can connect to the given URL.
79      */

80     boolean acceptsURL(String JavaDoc url) throws RemoteException JavaDoc, SQLException;
81
82
83     /**
84      * <p>The getPropertyInfo method is intended to allow a generic GUI tool to
85      * discover what properties it should prompt a human for in order to get
86      * enough information to connect to a database. Note that depending on
87      * the values the human has supplied so far, additional values may become
88      * necessary, so it may be necessary to iterate though several calls
89      * to getPropertyInfo.
90      *
91      * @param url The URL of the database to connect to.
92      * @param info A proposed list of tag/value pairs that will be sent on
93      * connect open.
94      * @return An array of DriverPropertyInfo objects describing possible
95      * properties. This array may be an empty array if no properties
96      * are required.
97      */

98     RJDriverPropertyInfo[] getPropertyInfo(String JavaDoc url,
99      java.util.Properties JavaDoc info) throws RemoteException JavaDoc, SQLException;
100
101
102     /**
103      * Get the driver's major version number. Initially this should be 1.
104      */

105     int getMajorVersion() throws RemoteException JavaDoc, SQLException;
106
107     /**
108      * Get the driver's minor version number. Initially this should be 0.
109      */

110     int getMinorVersion() throws RemoteException JavaDoc, SQLException;
111
112
113     /**
114      * Report whether the Driver is a genuine JDBC COMPLIANT (tm) driver.
115      * A driver may only report "true" here if it passes the JDBC compliance
116      * tests, otherwise it is required to return false.
117      *
118      * JDBC compliance requires full support for the JDBC API and full support
119      * for SQL 92 Entry Level. It is expected that JDBC compliant drivers will
120      * be available for all the major commercial databases.
121      *
122      * This method is not intended to encourage the development of non-JDBC
123      * compliant drivers, but is a recognition of the fact that some vendors
124      * are interested in using the JDBC API and framework for lightweight
125      * databases that do not support full database functionality, or for
126      * special databases such as document information retrieval where a SQL
127      * implementation may not be feasible.
128      */

129     boolean jdbcCompliant() throws RemoteException JavaDoc, SQLException;
130 }
131
132
Popular Tags