OpenSame: ISecurityConnection;
The OpenSame method opens a new connection with the DB server with the same parameters as in the current connection.
The method is applied for simultaneous work of users with the DB server. For example, several users replicate data in one and the same time series database at the same time. A separate connection is to be created for each user with the OpenSame method.
Executing the example requires that the repository contains a database with the OBJ_DB identifier. It is also necessary to add links to the Metabase and Db system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Db: IDatabase;
DbInst: IDatabaseInstance;
ConFirst: ISecurityConnection;
ConSecond: ISecurityConnection;
Begin
Mb := MetabaseClass.Active;
Db := Mb.ItemById("OBJ_DB").Bind As IDatabase;
DbInst := (Db As IMetabaseObject).Open(Null) As IDatabaseInstance;
ConFirst := DbInst.Connection;
ConSecond := ConFirst.OpenSame;
End Sub UserProc;
After executing the example two identical connections with the DB server are opened.
See also: