BASIC+Calc+HSQLDB: How to move registered database

asked 2019-11-17 11:05:37 +0200

lonk gravatar image

From the code:

Option Explicit

Function ConnectDatabase(dbFilename As String) As Object
    Dim dbContext As Object : dbContext = createUNOService("")
    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"
    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 ?

edit retag flag offensive close merge delete


| Fedora 31 Workstation KDE Desktop Spins | LibreOffice |

lonk gravatar imagelonk ( 2019-11-17 11:07:52 +0200 )edit

The error states Basic can not find such LibreOfficeCalcSampleCodes_HSQLDB name in registered DB names list. Maybe some misspelling in DB name while moving? Also check if the name is in registered DB list.

SM_Riga gravatar imageSM_Riga ( 2019-11-17 14:43:17 +0200 )edit