Class JenaDriver

java.lang.Object
org.apache.jena.jdbc.JenaDriver
All Implemented Interfaces:
Driver
Direct Known Subclasses:
MemDriver, RemoteEndpointDriver, TDBDriver

public abstract class JenaDriver extends Object implements Driver

Abstract implementation of a Jena JDBC driver

Connection URLs

All Jena JDBC drivers are expected to have connection URLs which start with the following:

 jdbc:jena:foo:
 

The jdbc:jena: portion is the common prefix for all Jena JDBC drivers, the foo: portion is an implementation specific prefix. Each Jena JDBC driver will have a different foo: prefix chosen such that it appropriately identifies at a glance the type of the underlying RDF database.

Connection URL Parameters

After the prefix a Jena JDBC connection URL consists of a sequence of key value pairs, the characters ampersand (&), semicolon (;) and pipe (|) are considered to be separators between pairs, the separators are reserved characters and may not be used in values. The key is separated from the value by a equals sign (=) though unlike the separators this is not a reserved character in values.

There is no notion of character escaping in connection parameters so if you need to use any of the reserved characters in your values then you should pass these to the connect(String, Properties) method directly in the Properties object.

Common Parameters

There are some common parameter understood by all Jena JDBC drivers and which apply regardless of driver implementation.

JDBC Compatibility Level

The first of these is the jdbc-compatibility parameter. To avoid typos when creating URLs programmatically a constant ( PARAM_JDBC_COMPATIBILITY) is provided which contains the parameter name exactly as the code expects it. This parameter provides an integer value in the range 1-9 which denotes how compatible the driver should attempt to be, see JdbcCompatibility for discussion on the meaning of compatibility levels.

When not set the JdbcCompatibility.DEFAULT compatibility level is used, note that JenaConnection objects support changing this after the connection has been established.

Pre-Processors

The second of these is the pre-processor parameter which is used to specify one/more CommandPreProcessor implementations to use. The parameter should be specified once for each pre-processor you wish to you and you should supply a fully qualified class name to ensure the pre-processor can be loaded and registered on your connections. The driver will report an error if you specify a class that cannot be appropriately loaded and registered.

Pre-processors are registered in the order that they are specified so if you use multiple pre-processors and they have ordering dependencies please ensure that you specify them in the desired order. Note that JenaConnection objects support changing registered pre-processors after the connection has been established.

Post-Processors

There is also a post-processor parameter which is used to specify one/more ResultsPostProcessor implementations to use. The parameter should be specified once for each post-processor you wish to use and you should supply a fully qualified class name to ensure the post-processor can be loaded and registered on your connections. The driver will report an error is you specify a class that cannot be appropriately loaded and registered.

Post-processors are registered in the order that they are specified so if you use multiple post-processors and they have ordering dependencies please ensure that you specify them in the desired order. Note that JenaConnection objects support changing registered post-processors after the connection has been established.

  • Field Details

    • DRIVER_PREFIX

      public static final String DRIVER_PREFIX
      Constant for the primary Jena JDBC Driver prefix, implementations supply an additional prefix which will form the next portion of the JDBC URL
      See Also:
    • PARAM_JDBC_COMPATIBILITY

      public static final String PARAM_JDBC_COMPATIBILITY
      Constant for the connection URL parameter which sets the desired JDBC compatibility level
      See Also:
    • PARAM_PRE_PROCESSOR

      public static final String PARAM_PRE_PROCESSOR
      Constant for the connection URL parameter used to set class names of CommandPreProcessor implementations to use with returned connections.

      This parameter may be specified multiple times and pre-processors will be registered (and thus applied) in the order specified. If any pre-processors are passed as part of the Properties object rather than in the connection URL then these will be registered (and thus applied) prior to those specified in the connection URL.

      See Also:
    • PARAM_POST_PROCESSOR

      public static final String PARAM_POST_PROCESSOR
      Constant for the connection URL parameter used to set class names of ResultsPostProcessor implementations to use with returned connections.

      This parameter may be specified multiple times and post-processors will be registered (and thus applied) in the order specified. If any post-processors are passed as part of the Properties object rather than in the connection URL then these will be registered (and thus applied) prior to those specified in the connection URL.

      See Also:
    • PARAM_USERNAME

      public static final String PARAM_USERNAME
      Constant for the standard JDBC connection URL parameter used to set user name for drivers that support authentication
      See Also:
    • PARAM_PASSWORD

      public static final String PARAM_PASSWORD
      Constant for the standard JDBC connection URL parameter used to set password for drivers that support authentication
      See Also:
    • PARAM_LOGGING

      @Deprecated public static final String PARAM_LOGGING
      Deprecated.
      No longer supported as of Jena 4.x
      Old connection URL property for having the driver configure logging, no longer supported as of Jena 4.x
      See Also:
    • NO_AUTO_LOGGING_CONFIGURATION

      @Deprecated public static final String NO_AUTO_LOGGING_CONFIGURATION
      Deprecated.
      Constant for the special value used with the PARAM_LOGGING parameter to indicate that the user code will manage configuration of logging. This is also the default value when that parameter is not set.
      See Also:
    • PARAM_CONFIG

      public static final String PARAM_CONFIG
      Constant for the connection URL parameter used to set the path to a Java properties file used to provide additional connection parameters external to the URL. This is useful when you want to have a single connection string and pick up different configurations depending on where the driver is used.

      Just like the PARAM_LOGGING parameter the file system is searched before the class path. Also note that this is the first parameter that is honored so settings present in the properties file may be overridden by those explicitly provided in the connection URL or those given in the Properties object passed to the Driver.connect(String, Properties) method.

      If you specify this parameter in both the connection URL and the Properties object then the latter takes precedence and the former is ignored. It is also important to note that this is not transitively resolved i.e. if the referenced property file includes a config parameter it does not result in a further properties file/files being loaded.

      See Also:
  • Constructor Details

    • JenaDriver

      public JenaDriver(int majorVer, int minorVer, String prefix)
      Creates a new driver
      Parameters:
      majorVer - Major Version
      minorVer - Minor Version
      prefix - Implementation specific prefix which must end with a colon
  • Method Details