How to register a new database driver
|
Contents |
||||||||
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 OpenOffice.org 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:
|
||||||||
The Macro |
||||||||
REM ***** BASIC ***** Sub Main ' access the global configuration provider Dim aConfigProvider As Object aConfigProvider = createUnoService( "com.sun.star.configuration.ConfigurationProvider" ) ' create an access object for the driver settings key Dim aDriverSettings As Object Dim aParams(0) As new com.sun.star.beans.PropertyValue aParams(0).Name = "nodepath" aParams(0).Value = "/org.openoffice.Office.DataAccess/UserDefinedDriverSettings" aDriverSettings = aConfigProvider.createInstanceWithArguments( _ "com.sun.star.configuration.ConfigurationUpdateAccess", _ 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 aDriverSettings.commitChanges End Sub |
||||||||
|
||||||||
|
||||||||
Auhor: Ocke
Janssen |
||||||||
|