All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----interbase.interclient.Driver
Each driver should supply a class that implements the Driver interface.
The DriverManager will try to load as many drivers as it can find and then for any given connection request, it will ask each driver in turn to try to connect to the target URL.
It is strongly recommended that each Driver class should be small and standalone so that the Driver class can be loaded and queried without bringing in vast quantities of supporting code.
When a Driver class is loaded, it should create an instance of itself and register it with the DriverManager. This means that a user can load and register a driver by doing Class.forName("interbase.interclient.Driver").
There are three ways to load the InterClient driver.
DriverManager.getConnection ("jdbc:interbase://server//database-dir/atlas.gdb", "sysdba", "masterkey");
Class.forName ("interbase.interclient.Driver"); DriverManager.getConnection ("jdbc:interbase://server//database-dir/atlas.gdb", "sysdba", "masterkey");When the Driver class is loaded, an anonymous driver instance is automatically created and registered with the driver manager. The driver manager will locate the driver instance based on the URL prefix "jdbc:interbase:".
A handle to the registered driver instance may be obtained as follows
java.sql.Driver registeredDriver = DriverManager.getDriver ("jdbc:interbase:");Now you can use Driver methods or InterClient Driver extensions such as the Monitor.
interbase.interclient.Monitor monitor = ((interbase.interclient.Driver) registeredDriver).getMonitor (); monitor.enableAllTraces (true); monitor.setTraceStream (System.out); DriverManager.getConnection ("jdbc:interbase://server//database-dir/atlas.gdb", "sysdba", "masterkey"); // jdbc calls are traced.
Driver unregisteredDriver = new interbase.interclient.Driver (); java.sql.Connection connection = unregisteredDriver.connect ("jdbc:interbase://server//database-dir/atlas.gdb", properties);In this case, the named driver is not registered with the driver manager and can be used directly to get a connection. Here's an example of its use.
import interbase.interclient.*; Driver unregisteredDriver = new Driver (); Monitor monitor = unregisteredDriver.getMonitor (); monitor.setTraceStream (System.out); monitor.enableAllTraces (true); ConnectionProperties properties = new ConnectionProperties (); properties.setUser ("sysdba", "masterkey"); java.sql.Connection connection = unregisteredDriver.connect ("jdbc:interbase://server//databases/atlas.gdb", properties);Keep in mind that even if you use an unregistered driver, an anonymous driver instance is still created and registered with the driver manager when the interbase.interclient.Driver class is loaded into memory. A call to DriverManager.getConnection() would be using a different driver instance than a call to unregisteredDriver.connect() as above.
Driver driver = new interbase.interclient.Driver (); java.sql.DriverManager.registerDriver (driver);However, registering multiple InterClient driver instances would only be necessary if different instances recognized different URL prefixes. For now, the InterClient driver only recognizes "jdbc:interbase:".
Note for JBuilder users:
In order to use the InterClient driver with JBuilder, you should modify CLASSPATH and IDECLASSPATH in your JBuilder.INI file to include
interclient-install-dir\classesor
interclient-install-dir\interclient.jar.The JBuilder.INI file is located in JBuilder's bin directory.
Here is how to establish a database connection with the JBuilder dataset package.
import java.sql.*; import borland.jbcl.dataset.*; borland.jbcl.dataset.Database database = new Database (); database.setConnection ( new ConnectionDescriptor ("jdbc:interbase://server//databases/atlas.gdb", "sysdba", "masterkey", false, "interbase.interclient.Driver")); borland.jbcl.dataset.QueryDataSet queryDataSet = new QueryDataSet (); queryDataSet.setQuery (new QueryDescriptor (database, "select * from employee", null, true, false));For further information, see the JBuilder Programmer's guide, Chapter 5.
Although an InterClient driver may have an expiration date, for most general releases InterClient itself will not expire. Instead the InterServer component has an expiration date defined in the InterServer license file (ic_license.dat). Newer releases of InterServer may refuse to talk with older releases of InterClient. In this way, an older release of InterClient is effectively expired when all compatible versions of InterServer expire. A customer wishing to continue using a older version of InterServer/InterClient, may substitute in a new ic_license.dat file with an extended license.
public Driver()
public synchronized Connection connect(String url, Properties properties) throws SQLException
The driver should raise a 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 passed arbitrary string tag/value pairs as connection arguments. Normally at least "user" and "password" properties should be included in the Properties. The ConnectionProperties class is supplied as a convenience for setting connection properties before requesting a connection.
public boolean acceptsURL(String url) throws SQLException
public synchronized DriverPropertyInfo[] getPropertyInfo(String url, Properties properties)
public int getMajorVersion()
public int getMinorVersion()
public boolean jdbcCompliant()
JDBC compliance requires full support for the JDBC API and full support for SQL 92 Entry Level. It is expected that JDBC compliant drivers will be available for all the major commercial databases.
This method is not intended to encourage the development of non-JDBC compliant drivers, but is a recognition of the fact that some vendors are interested in using the JDBC API and framework for lightweight databases that do not support full database functionality, or for special databases such as document information retrieval where a SQL implementation may not be feasible.
InterBase is only two features shy of compliance:
public int getBuildNumber()
public Date getExpirationDate()
Returns null if the InterClient driver does not expire.
Note: Although InterClient may not expire, InterServer may.
public boolean expiredDriver()
public boolean clientServerEdition()
The non-client/server edition allows only "localhost" connections.
public String getJDBCNetProtocol()
A type 3 JDBC driver, such as InterClient, establishes a DBMS independent communication layer between the JDBC client and a middleware server (InterServer). Of course, InterServer uses a DBMS specific protocol for talking with the InterBase server on the backend.
public int getJDBCNetProtocolVersion()
public String getCompanyName()
public static String asString(SQLException e)
public Monitor getMonitor()
public Server getServer(String serverURL, String sysdba, String password) throws SQLException
You must pass SYSDBA user and password to obtain a Server object.
Note: This does not start the InterBase service. The InterBase service is started with the Server.startup () method.
All Packages Class Hierarchy This Package Previous Next Index