Connection String Samples
This topic provides some typical samples of connection strings
These examples assume the default blackpearl security labels are in place, where the 'K2' security label equates to Active Directory and the 'K2SQL' security label works with the SQL User Manager
For claims authentication and custom user managers, the following properties in the connection string remain the same as for windows authentication:
host={MachineName};
port={K2PortNumber};
Integrated=true;
IsPrimary=true;
Authenticate=true
Make a connection under the currently Windows Identity that is running this code
SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder builder = new SCConnectionStringBuilder();
builder.Authenticate = true;
builder.Host = "localhost";
builder.Port = 5555;
builder.Integrated = true;
builder.IsPrimaryLogin = true;
builder.SecurityLabelName = "K2";
Force the connection under a specific AD Identity
SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder builder = new SCConnectionStringBuilder();
builder.Authenticate = true;
builder.Host = "localhost";
builder.Port = 5555;
builder.Integrated = false;
builder.IsPrimaryLogin = true;
builder.SecurityLabelName = "K2";
builder.WindowsDomain = "domain";
builder.UserID = "username";
builder.Password = "password";
Make a connection that authenticates against the K2 SQL User Manager
SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder builder = new SCConnectionStringBuilder();
builder.Authenticate = true;
builder.Host = "localhost";
builder.Port = 5555;
builder.Integrated = false;
builder.IsPrimaryLogin = true;
builder.SecurityLabelName = "K2SQL";
builder.UserID = "username";
builder.Password = "password";
Using the connection string
Once you have constructed the connection string, you can use it to establish a connection to K2. Here are same examples:
SourceCode.Workflow.Client.Connection WorkflowClientConnection = new Connection();
WorkflowClientConnection.Open("localhost", builder.ConnectionString);
SourceCode.Workflow.Management.WorkflowManagementServer WorkflowManagementConnection = new WorkflowManagementServer();
WorkflowManagementConnection.Connection.Open(builder.ConnectionString);
SourceCode.SmartObjects.Client.SmartObjectClientServer SmartObjectClientServerConnection = new SmartObjectClientServer();
SmartObjectClientServerConnection.CreateConnection();
SmartObjectClientServerConnection.Connection.Open(builder.ConnectionString);