Connecting Drivers to K2

The drivers.list file

At startup, K2 reads in a file whose name is specified in its K2.system.Server.DRIVERS property. This file, commonly named drivers.list, contains all the information K2 needs to connect to its drivers.

This file contains a series of properties and values, in which each property/value pair is on a separate line. In each, the property name is followed by an equals sign (=), followed by the value. Blank lines and lines beginning with a hash (#) are ignored. Long lines may be continued using a backslash (\). All comma-separated lists should not contain any whitespace.

The first property must be drivers, whose value is a comma-separated list of the names of the drivers to which K2 should connect. The remainder of the file contains driver and connection specifications. Note that if a specification exists in this file but the driver name is not listed for the drivers property, the specification will be silently ignored by K2.

A driver and connection specification is a collection of properties that sets up K2 to connect to a specific driver. There are two kinds of properties in a specification, of the form driver_name.option and connection_name.option. In the first, the driver_name part is the name used in the drivers property above. The .option part must be one of the following, and each must appear exactly once for each driver:

.class
A Java™ class implementing K2.driver.DriverA which will handle connections to the data source. This class must be in the CLASSPATH environment variable when the K2 server starts up.
.initargs
A comma-separated list of parameters to be passed to a constructor of the class. This varies depending on the class being used. See the documentation for the driver for more information.
.connections
A comma-separated list of connection names. These are the names which will be exported into K2's environment, as the name of the "native query function" for the connection.

For each connection name listed for the .connections option there may be a corresponding set of properties, consisting of a connection name, an option, and its value. The following options are allowed, but not required:

.nconnections
A single connection name can map to a pool of physical connections to the data source. K2 will make use of all the connections it can in order to parallelize query evaluation. [Default: 1]
.cacheresults
If true, K2 will cache the results of queries sent to the driver, in order to reuse them when the same query is asked again. This can blow up memory usage tremendously, and should only be used advisedly. [Default: false]

Other options are possible, depending on the requirements of the driver. See the documentation for the connection class for more information.

Here is an example drivers.list file.


[Tech Docs Index]