TTdbDatabase.ConnectionId
TTdbDatabase   See also
Top 


Indicates the id that identifies this database connection.

property ConnectionId: Integer;

Description
Read this property to determine the id of the database connection you are using. Every time the TTdbDatabase object connects to the TurboDB engine it is assigned a unique connection id. This connection id is used in lock files to identify the locking database connection. You can set this property to force TTdbDatabase to reestablish a formely closed or interrupted connection.

Saving the ConnectionId in a configuration file and setting it at reconnect is useful for applications which loose their database connections e.g. by crashing, disconnecting from the network. In this case the application is still registered in lock files to use a given database table even if it doesn't. Therefore you will see error messages like "The table is still in use by another application" or "The table is locked by another user" at certain operations (e.g. altering, deleting, indexing) and you will have to delete the lock files carefully by hand to continue work. If you reuse the connection id after restart, your application will log-in with its former identity and produce no errors.