Hi Frank,
Frank Schönheit - Sun Microsystems Germany schrieb:
Hi Peter,
yes, there's a property "inactivity-timeout" with default "30".
So MyConnection = XDriver.getConnectionWithInfo() works fine for me. But
how to replace the ActiveConnection of the form with the new one? The
dev-guide says, it can be set from outside, but XForm.ActiveConnection =
MyConnection fails. Any hints?
First, you could try to add the inactivity-timeout to the data source's
"Info" member. (There's also a property "Settings", which mirrors the
Info, but is a XPropertySet/XPropertyBag, so you could do something like
oDataSource.Settings.addProperty( "inactivity-timeout", ... ) as most
convenient way). Those settings are persistent, so you need to do this
only once. Now when Base connects, it passes all the properties in the
"Info" sequence which it doesn't know to the system driver. This way,
all your connections (in particular the ones for the forms) should
inherit this setting.
After
oContext = CreateUNOService("com.sun.star.sdb.DatabaseContext")
oDataSource = oContext.getByname(MyURL)
oDataSource.Settings.addProperty("inactivity-timeout",0,"600")
I can find this new Property in the Settings, but not in the "Info" member.
But it seems not to be persistent, shouldn't I find an entry in the
content.xml?
(I tried with closed and opened document)
<db:data-source db:connection-resource="jdbc:oracle:thin:@xxx:xxx"
db:suppress-version-columns="true" db:append-table-alias-name="true"
db:java-driver-class="oracle.jdbc.driver.OracleDriver"
db:parameter-name-substitution="true">
<db:login db:user-name="xxx" db:is-password-required="true"/>
<db:table-filter>
<db:table-filter-pattern>%</db:table-filter-pattern>
</db:table-filter>
</db:data-source>
After closing the application the new setting vanished.
Second I tried:
aInfo() = oDataSource.Info
i = UBound(aInfo())+1
Dim aInfoNew(i) as new com.sun.star.beans.PropertyValue
For n = 0 to UBound(aInfo())
aInfoNew(n).Name = aInfo(n).Name
aInfoNew(n).Value = aInfo(n).Value
next
aInfoNew(i).Name = "inactivity-timeout"
aInfoNew(i).Value = "600"
oDataSource.Info = aInfoNew()
without success, oDataSource.Info isn't modified.
Perhaps I should try to modify the content.xml? May be the char "-"
causes problems?
If this doesn't work for whatever reasons (I'd be interested in the
results), then try doing a reload at the form after you have set the
connection - this should force the form to use the new connection. If
this doesn't work, too - then more details about how you do this, please.
If bNewCon = false then 'global flag
oCon = oDriver.getConnectionWithInfo(sDatabaseURL,mDBProperties())
wait 1000
oForm.Reload()
wait 5000 'yes, should create a XLoadListener here
For i = 0 to UBound(oForm.ActiveConnection.Metadata.ConnectionInfo())
sTmp = sTmp & CHR(13) &
oForm.ActiveConnection.Metadata.ConnectionInfo(i).Name
next
msgBox sTmp
'without inactivity-timeout
For i = 0 to UBound(oCon.Metadata.ConnectionInfo())
sTmp = sTmp & CHR(13) & oCon.Metadata.ConnectionInfo(i).Name
next
msgBox sTmp
'with inactivity-timeout
bNewCon = true
End If
Regards
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]