Extending Database Drivers

From Apache OpenOffice Wiki
Jump to: navigation, search



In the following section, extending existing SDBC drivers by extensions is described. These section is valid from since: OpenOffice.org 3.3

Most drivers miss to support special features like to alter view definitions or to add or drop key of a table. Therefore these interfaces

can be implemented by an extension.

To enable the needed feature the extension has to extend the properties entry of the configuration of the driver. The configuration entry below the properties entry will be checked and if the service name can be instantiated it will be used to do the job. Below you'll see a table of mapping from configuration entry to service name.

Configuration name Interface name which has to to be implemented
ViewAccessServiceName com.sun.star.sdb.tools.XViewAccess
TableAlterationServiceName com.sun.star.sdb.tools.XTableAlteration
TableRenameServiceName com.sun.star.sdb.tools.XTableRename
IndexAlterationServiceName com.sun.star.sdb.tools.XIndexAlteration
KeyAlterationServiceName com.sun.star.sdb.tools.XKeyAlteration

In favor to allow to get the definition of queries, forms and reports from other locations as the default file format specification, an extension may implement the com.sun.star.sdb.DocumentContainer service. The configuration entries are named

  • Forms
  • Reports

additionally to the interfaces defined in the service com.sun.star.sdb.DocumentContainer the interface com.sun.star.lang.XInitialization has to be implemented which will be called with a argument called "DatabaseDocument" containing the database document.

To allow to support command definitions from other locations, an extension may implement the com.sun.star.sdb.DefinitionContainer service. The configuration entry is named

  • CommandDefinitions

A difference is that the interface com.sun.star.lang.XInitialization will be called with a "DataSource" argument.

The configuration fragment below shows how to define which service should be created to extend the view support and to extend the table alteration support.

<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <node oor:name="Installed">
    <node oor:name="jdbc:" oor:op="replace">
      <prop oor:name="ParentURLPattern">
        <value>jdbc:*</value>
      </prop>
      <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
        <value xml:lang="en-US">SQL 2008 JDBC</value>
      </prop>
      <node oor:name="Properties">
        <node oor:name="ViewAccessServiceName" oor:op="replace">
          <prop oor:name="Value" oor:type="xs:string">
            <value>com.sun.star.sdb.comp.SQL2008.ViewAccess</value>
          </prop>
        </node>
        <node oor:name="TableAlterationServiceName" oor:op="replace">
          <prop oor:name="Value" oor:type="xs:string">
            <value>com.sun.star.sdb.comp.SQL2008.TableAlterService</value>
          </prop>
        </node>
      </node>
    </node>
  </node>
</oor:component-data>
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages