Hi, I am starting a new question, as an earlier question has developed into 2 main different approaches. In the original question (link) I was looking for a clean closedown of LibreOffice when a Form closes. One of the suggested solutions by Mr Ratslinger was instead to use a standalone Form, based on original suggestions from DACM in 2009 (link).
The original Base connection was from file “connection_asmedb.odb” which connected to a Firebird 3.0 database called “ASMEDB.fdb”
Connection was through:
jdbc: firebirdsql:oo:localhost:c:\d\libre\ASMEDB.FDB?charSet=UTF-8 JDBC driver class: org.firebirdsql.jdbc.FBDriver user: webusrjhn password: whatever
I have followed the instructions (link) and generated “connection_asmedb.odt”, and managed to get this to work except for automatically connecting to the non-embedded Firebird database ASMEDB.FDB. The macro I used previously is included below.
I have tried binding this macro using Customize to various startup events:
Start Application, Document created, Open Document, Activate Document, New Document, Document loading finished.
It happily ignores them all and keeps prompting me for the password of “webusrjhn”.
How can I automatically and transparently connect to the database without having to provide the password each
Sub connect_to_database ' bound to Open Document Event (see Customize - Events - Open Document) ' run once when connection_asmedb.odb file opened Dim sURL as string Dim oArgs(0) As New com.sun.star.beans.PropertyValue Dim oDocStatus as object Dim oIhandler oIhandler = CreateUnoListener("InteractionHandler_", "com.sun.star.task.XInteractionHandler") ' sURL = "file:///C:/d/libre/connection_asmedb.odb" 'Windows ' sURL = "file:///home/nexturejohn/Databases/connection_asmedb.odb" 'Lubuntu sURL = ThisComponent.getLocation() ' MsgBox "sURL apparently is = " & sURL oArgs(0).Name = "InteractionHandler" oArgs(0).Value = oIhandler oDocStatus = StarDesktop.loadComponentFromURL(sURL, "_default", 0, oArgs) oDocStatus.DataSource.Password = "whatever" End Sub