Another option would be to use the "Database Options" callback. This is called before client Main Sequence.
The DB connection string is located at:
Parameters.DatabaseOptions.ConnectionString
Unfortunately it seems that there is no option to gather this string using TS API, but the custom Operator Interface at start can eventually run in background a dedicated sequence just to get it. In this case it would be better also to set:
Parameters.DatabaseOptions.DisableDatabaseLogging = True
to avoid adding useless log entries in DB when calling the dedicated sequence at each Operator Interface start.