Connection String Samples
Here are some typical connection string samples
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
Make a connection under the currently Windows Identity that is running this code
SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder builder = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder(); builder.Authenticate = true; builder.Host = "localhost"; builder.Port = 5555; //use port 5252 for SourceCode.Workflow.Client connections builder.Integrated = true; builder.IsPrimaryLogin = true; builder.SecurityLabelName = "K2";
Force the connection under a specific AD Identity
SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder builder = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder(); builder.Authenticate = true; builder.Host = "localhost"; builder.Port = 5555; //use port 5252 for SourceCode.Workflow.Client connections builder.Integrated = true; 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 SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder(); builder.Authenticate = true; builder.Host = "localhost"; builder.Port = 5555; //use port 5252 for SourceCode.Workflow.Client connections 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
SourceCode.Workflow.Client.Connection oConn = new SourceCode.Workflow.Client.Connection(); oConn.Open("localhost", builder.ConnectionString);
SourceCode.Workflow.Management
SourceCode.Workflow.Management.WorkflowManagementServer oConn = new SourceCode.Workflow.Management.WorkflowManagementServer(); oConn.Connection.Open(builder.ConnectionString);
SourceCode.SmartObjects.Client
SourceCode.SmartObjects.Client.SmartObjectClientServer oConn = new SourceCode.SmartObjects.Client.SmartObjectClientServer(); oConn.CreateConnection(); oConn.Connection.Open(builder.ConnectionString);