Using java.sql.driver Methods

From InterBase

The java.sql.Driver class has different methods than java.sql.DriverManager. If you want to use any of the java.sql.Driver methods, you need to create an explicit driver object. The following are a few of the driver methods:

  • getMajorVersion() gets the driver's major version number.
  • getMinorVersion() gets the driver's minor version number.

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");
Important: If your application ever needs to access non-InterBase databases, do not define a driver object as a type interbase.interclient.Driver as follows:
interbase.interclient.Driver driver = new interbase.interclient.Driver();

This method creates a driver object that is an instance of the interbase.interclient.Driver class, not a generic instance of the java.sql.Driver class. It is not appropriate for a database-independent client program because it hard-codes the InterClient driver into your source code, together with all of the classes and methods that are specific to the InterClient driver. Such applications could access only InterBase databases.