Coding timeout of calc driver connections

Good Morning,

Tools → Options → LibreOffice Base-> Connections

I can set the timeout for various drivers, in my case the calc driver as described:

Connections (libreoffice.org)

However I would like to know if there is a way to code this rather than go through the configuration?

Thank you

Zafar

I set this value to 999 seconds and searched for 999 in /registrymodifications.xcu, which is the file where most settings are stored. The value could not be found, so I had a second look at the options dialog and found out that LO had set back this value to 600 which seems to be an upper limit.
So I tried 555 and found 555 at

<item oor:path="/org.openoffice.Office.DataAccess/ConnectionPool/DriverSettings/org.openoffice.Office.DataAccess:DriverPooling['com.sun.star.comp.sdbc.calc.ODriver']">
<prop oor:name="Timeout" oor:op="fuse">
<value>555</value>
</prop>
</item>

I copy the whole path /org.openoffice.Office.DataAccess/ConnectionPool/DriverSettings/org.openoffice.Office.DataAccess:DriverPooling['com.sun.star.comp.sdbc.calc.ODriver'], start MRI, call mri-menu:Targets>Configuration… and paste the path into the prompt.
Now I see all the UNO properties related to that configuration node. Among them:
DriverName=com.sun.star.comp.sdbc.calc.ODriver
Enable=True
Timeout=555

I turn the MRI tool from get mode into set mode, double-click the Timeout property and — nothing happens.
Having a closer look at the property:
Timeout long 555 Maybevoid,Bound,Constrained,Read_Only

At this point I’m stuck for now.

P.S. 555 and its config path could also be found and modified in Tools>Options>Advanced [Open Expert Configuration…]

Sub ChangeTimeOut
    Dim keyNode As Object, oDriver As Object
    With GlobalScope.Basiclibraries
        If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
    End With
    keyNode = Tools.Misc.GetRegistryKeyContent("org.openoffice.Office.DataAccess/ConnectionPool/DriverSettings", True)
    oDriver=keyNode.getByName("com.sun.star.comp.sdbc.calc.ODriver")
    oDriver.TimeOut=555
    keyNode.commitChanges    
End Sub
2 Likes

And because there is a Python tag on top of this, I copied both Basic routines into my Python editor, changed syntax, case-sensitive stuff and some basics.

import uno

def GetRegistryKeyContent(sKeyName, bForUpdate=False):
    ctx = uno.getComponentContext()
    smgr = ctx.getServiceManager()
    oConfigProvider = smgr.createInstance("com.sun.star.configuration.ConfigurationProvider")
    aNodePath = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
    aNodePath.Name = "nodepath"
    aNodePath.Value = sKeyName
    if bForUpdate:
        return oConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", (aNodePath,))
    else:
        return oConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", (aNodePath,))

def ChangeTimeOut():
    keyNode = GetRegistryKeyContent("org.openoffice.Office.DataAccess/ConnectionPool/DriverSettings", True)
    oDriver=keyNode.getByName("com.sun.star.comp.sdbc.calc.ODriver")
    oDriver.Timeout=555
    oDriver.Enable = True
    keyNode.commitChanges()

Edit: added oDriver.Enable = True which is the equivalent of the on/off checkbox in the config dialog.

2 Likes

this is going to be very useful. thank you.