How can a Adabas D database be added to the DatabaseContext?
/* get the service manager */
xContext = UNO.connect()
XMcf = xContext~getServiceManager
/* retrieve the DatabaseContext and get its XSingleServiceFactory interface */
xSingleServiceFactory = xMcf~createInstanceWithContext(-
"com.sun.star.sdb.DatabaseContext", xContext)~XSingleServiceFactory
/* create a new generic data source */
dataSource = xSingleServiceFactory~createInstance
/* setting the necessary data source properties */
xPropertySet = dataSource~XPropertySet
/* Adabas D URL */
xPropertySet~setPropertyValue("URL", "sdbc:adabas::MYDB")
/* force password dialog */
xPropertySet~setPropertyValue(-
"IsPasswordRequired",.bsf~new("java.lang.Boolean","true"))
/* suggest 'demo' as user name */
xPropertySet~setPropertyValue("User", "demo")
/* get the XDocumentDataSource interface of the data source */
xDocumentDataSource = dataSource~XDocumentDataSource
/* get the OfficeDatabaseDocument service via the 'DatabaseDocument' attribute*/
xOfficeDatabaseDocument = xDocumentDataSource~getDatabaseDocument
/* retrieve the XStorable, xClosable, and XModel interface */
xStorable = xOfficeDatabaseDocument~XStorable
xCloseable = xOfficeDatabaseDocument~XCloseable
xModel = xOfficeDatabaseDocument~XModel
/* register it with the database context */
xNamingService = xSingleServiceFactory~XNamingService
url = uno.ConvertToURL("c:\odbfiles\adabas1.odb")
xStorable~storeAsURL(url,xModel~getArgs)
xNamingService~registerObject("adabas-test", dataSource)
say "database document has been stored to '"url"' !"
/* close database */
xCloseable~close(.true)
::requires UNO.cls -- get UNO support