Desktop User Guides > Professional > Data management scripting > Publishing data > Publishing RDB2 data to Cognos via mrScript
 
Publishing RDB2 data to Cognos via mrScript
The following sample .mrs script is installed with the UNICOM Intelligence Developer Documentation Library at [INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Scripts\General.
HouseholdToCognos.mrs
The sample performs the following tasks, and is based on the UNICOM Intelligence Developer Documentation Library Household sample:
Specifies the UNICOM Intelligence RDB2 data.
Specifies the Dimension and Measure questions to be published.
Creates a Cognos package and publishes it to the Cognos server.
'Note: You must update the Cognos Server IP, RDB2 Server IP, and
'      RDB database names
Dim CognosServerURl,MetaDataFile,CognosDataSourceName,
    CognosPackageFile
Dim DataCollectionRDBServer,
DataCollectionDBName
DataCollectionRDBServer = "<RDBSERVERURL>"
DataCollectionDBName = "household"

CognosServerURL =
    "http://<COGNOSSERVERURL>:9300/p2pd/servlet/dispatch" MetaDataFile = "C:\Program Files\
    IBM\SPSS\DataCollection\7\DDL\Data\RDB\household.mdd"

CognosPackageFile = "/Public Folders/HouseHoldPackage"
CognosDataSourceName = "HouseHold"
Dim CognosExposer
'Used to exposing to Cognos
Set CognosExposer = CreateObject("ExposeToCognos.Exposer")

'Specify Data collection RDB2 data and detailed IP address, even
'when localhost needs to be specified,
'since it is used to connect to the Cognos Server CognosExposer.CaseDataConnectionString ="Provider=MSOLEDBSQL.1; Integrated Security=SSPI;Persist Security Info=False;Data Source= "+DataCollectionRDBServer+";Initial Catalog="+DataCollectionDBName

'Specify related mdd file for RDB2 data
CognosExposer.MddLocation = MetaDataFile
CognosExposer.MetadataVersion = "{..}"

'Specify Dimension / Measure questions to be exposed
'ConfigrationSetting.DimensionQuestions = '    "region,tenure,Person.Gender,Person.Languages" 'ConfigrationSetting.MeasureQuestions =
'     "numpersons,numrooms,Person.age" CognosExposer.SystemVariableSelection = 0

'Specify Cognos Server URL and credentials
CognosExposer.CognosServerURL = CognosServerURl
CognosExposer.CredentialsForLogin
Cognos.Anonymous = True

'Or you can login by specified user
'CognosExposer.CredentialsForLoginCognos.Namespace = "spss"
'CognosExposer.CredentialsForLoginCognos.UserID = "mrpdtest"
'CognosExposer.CredentialsForLoginCognos.Password = "Pass1234"

'Expose to Cognos Server
CognosExposer.CreatePackage(CognosPackageFile,
    CognosDataSourceName , "")

Debug.Log("Completed!")
See
Publishing data