The Free and Open Productivity Suite
Apache OpenOffice 4.1.8 released

OpenOfficeHow to register a new database driver
into OpenOffice UI?


The Problem
The Solution
The Macro

The Problem

You may want to use a new database driver for your database in OpenOffice but OpenOffice doesn't know it.

The Solution

The UI supports the extension of database drivers through a configuration entry.

Two steps have to be done before you can use your new driver with OpenOffice.
The first step is to copy the new driver in the folder $office/user/uno_packages. After that you have to run the command $office/program/pkgchk. This command register the new driver. In the future it will be possible to run only the pkgchk program to register the driver and to insert the configuration entry.
The second step is to adjust the macro and run it to insert a configuration entry.

Three names have to be set in the macro:


This name will be used for the Tabpage of the new database driver.


This name will be used in the database type listbox on the general tabpage in the data source administration dialog.


This name will be the prefix for the URL of the new database driver. This name has to end with a colon.


The file extension, which match to this type. Only set when it is file based driver.

The Macro

REM  *****  BASIC  *****

Sub Main
	' access the global configuration provider
	Dim aConfigProvider As Object
	aConfigProvider = createUnoService( "" )

	' create an access object for the driver settings key
	Dim aDriverSettings As Object
	Dim aParams(0) As new
	aParams(0).Name = "nodepath"
	aParams(0).Value = "/org.openoffice.Office.DataAccess/UserDefinedDriverSettings"
	aDriverSettings = aConfigProvider.createInstanceWithArguments( _
	"", _
	aParams() )

	aDrv = aDriverSettings.createInstance()

	aDrv.DriverPageDisplayName ="Ocke's own private Driver page"
	aDrv.DriverTypeDisplayName = "Neo_1" ' this name will be displayed in the Type listbox on the general tabpage
	aDrv.DriverDsnPrefix ="sdbc:matrix:"    ' this name will be the prefix of the URL
	aDrv.Extension = "*.OJ" ' will be used by the fileopen dialog

	' create an access object for the mozilla preferences node

	aDriverSettings.insertByName( "Neo_1",aDrv ) ' just a name to make it distinct

	' commit the changes done
End Sub

Auhor: Ocke Janssen
Last Modified: $Date: 2004/10/15 08:12:12 $
Copyright © 2001

Apache Events

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache, OpenOffice, and the seagull logo are registered trademarks of The Apache Software Foundation. The Apache feather logo is a trademark of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.