Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

BASIC+Calc+HSQLDB: How to move registered database

From the code:

Option Explicit

Function ConnectDatabase(dbFilename As String) As Object
    Dim dbContext As Object : dbContext = createUNOService("com.sun.star.sdb.DatabaseContext")
    Dim oDataSource As Object : oDataSource = dbContext.GetByName(dbFilename)
    ConnectDatabase = oDataSource.GetConnection("","")'>>("Username","Password")
End Function

Sub TestDatabase
    Dim db As Object
    db = ConnectDatabase("LibreOfficeCalcSampleCodes_HSQLDB")
    MsgBox "Connection completed"
    DisconnectDatabase(db)
    MsgBox "Disconnection completed"
End Sub

Initially , registered LibreOfficeCalcSampleCodes_HSQLDB.odb was in folder /home/fedora002/Documents and the database could be connected.

Then, I moved the database to subfolder /home/fedora002/Documents/BASICMacro temporarily.

And finally I moved the database back to the initial folder /home/fedora002/Documents .

There was an error message:

image description

Why can't the registered database be moved to other folders even when it was moved back to the initial folder ?