Finding an activity's connection string
There are two ways of finding an activity’s connection string.
Method 1
You can extract the information from the Distributed Property Management (DPM) DataLocation property for the UNICOM Intelligence Interviewer - Server Admin project, as follows:
// First authenticate the agent...
SPSSMR.DPM.IAgent2 agent = SPSSMR.Web.Utilities.Agent.GetInstance();
if (!SPSSMR.Web.Utilities.Agent.Login(oAgent)) return;
// projectName must contain the name of the
// UNICOM Intelligence Interviewer - Server Admin project...
SPSSMR.DPM.IProject dpmProject = agent.Server.Projects.Item(projectName);
// Get the DataLocation property from DPM...
string connectionString = (string) dpmProject.Properties.Item("DataLocation").Value;
// DataLocation contains an aliased folder name
// in the Initial Catalog setting. So we use the File
// Management component to resolve this
// to an actual folder name. First create the File
// Manager object...
MRFILEMGTLib.FMAdmin fileManager = new MRFILEMGTLib.FMAdminClass();
// Now resolve the aliased folder name...
connectionString = fileManager.ResolveFolderName(agent.UserName, agent.Ticket, connectionString, MRFILEMGTLib.tag_MRFM_FOLDER_ACCESSTYPE.FAT_DEFAULT);
Warning: To maintain security, do not display a connection string with a resolved folder name to the user. It is acceptable to display the aliased folder name.
The File Management component library is MRFileMgt.dll in folder C:Program FilesCommon FilesIBMSPSSDataCollection7 ProjectMgmt.
Method 2
If you want a connection for a reporting activity, and you know that the project is an UNICOM Intelligence Interviewer - Server Admin project, you can use the following code instead:
ADODB.Connection connection = System.Web.Caching.DataConnectionCache.GetProjectRDB2Connection( ApplicationUtils.WebApplicationSettings.Project )
See SPSSMR.Web.Caching.DataConnectionCache for more information.
See also