About InterClient Drivers

Loading the InterClient Driver

The InterClient driver must be loaded before your application can attempt to connect to an InterBase database. To explicitly load the InterClient driver with the DriverManager, include the following line in your program before using the driver to establish a database connection:
Class.forName("interbase.interclient.Driver");

The first time the Java interpreter sees a reference to interbase.interclient.Driver, it loads the InterClient driver. When the driver is loaded it automatically creates an instance of itself, but there is no handle for it that lets you access that driver directly by name. This driver is "anonymous"; you don't need to reference it explicitly to make a database connection. You can make a database connection simply by using the java.sql.DriverManager class.

It's the responsibility of each newly loaded driver to register itself with the DriverManager; the programmer is not required to register the driver explicitly. After the driver is registered, the DriverManager can use it to make database connections.

Creating the InterClient Driver Explicitly

When writing a client program, you can interact either with the DriverManager class or with a database driver object directly. To reference an InterClient driver directly, you must explicitly create another instance (in addition to the anonymous one that's created automatically during loading) of the driver using the java.sql.Driver class:
java.sql.Driver driver = new interbase.interclient.Driver();
Now you can reference the driver classes and methods with "driver.XXX()." If all you need to do is connect to the database and execute SQL statements, you don't need to create a driver object explicitly; the DriverManager handles everything for you. However, there are a few cases when you need to reference the driver by name. These include: The DriverManager sees driver as only one of many standard JDBC drivers that can be loaded. If you need to create a connection to another type of database in the future, you need only to load the new driver with forName() or declare another driver explicitly with
java.sql.Driver driver = new XXX.Driver

Using java.sql.Driver Methods

The java.sql.Driver class has different methods than java.sql.DriverManager (Refer to the JDBC API.).  The following are a few of the driver methods: The example below shows how to interact with the database by referencing the driver directly:
//create the InterClient driver object as a JDBC driver
java.sql.Driver driver = new interbase.interclient.Driver ();

//get the connection object
java.sql.Connection connection = driver.connect (dbURL, properties);

//reference driver to get the driver version number 
java.sql.String version = driver.getMajorVersion () + driver.getMinorVersion ();

System.out.print ("You're using driver", + version");

What NOT to do: InterClient-Only object instances

Don't create connection and driver instances of type interbase.interclient.Driver and interbase.interclient.Connection
interbase.interclient.Driver d = new interbase.interclient.Driver ();
interbase.interclient.Connection c = d.connect (dbURL, properties);
This creates an InterClient specific connection instance rather than a generic java.sql.Connection instance. Declaring your InterClient objects as java.sql interface instances allows for more database independence and code portability. If you choose to use an InterClient extension method on such an object, an explicit cast is required. This has the added bonus of tagging non-portable code fragments.