Desktop User Guides > Professional > Data management scripting > Publishing data > Publishing non-RDB2 data to Cognos via a DMS script
Publishing non-RDB2 data to Cognos via a DMS script
The following sample .dms script is installed with the UNICOM Intelligence Developer Documentation Library at [INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Scripts\Data Management.
The sample performs the following tasks, and is based on the UNICOM Intelligence Developer Documentation Library Museum sample:
Transforms DDF data to RDB2 data.
After the transformation, a new component is called to build the required Cognos schema.
After the schema is prepared, a Cognos package is created and then published to the Cognos server.
'Note: Update the Cognos Server IP and RDB2 Server IP accordingly
'Cannot use localhost because the Cognos Server needs to build a
'Datasource in order to connect to the RDB2 DB
#Define DataCollectionRDBServer "<RDBSERVERURL>"
#Define DataCollectionDBName "CognosMuseum"
#Define RDBMetaDataFile "C:\Program Files\
#Define CognosServer "<COGNOSSERVERURL>"
#Define CognosPackage "/Public Folders/MuseumPackage"
#Define CognosDataSource "DataCognosMuseum"

  ConnectionString = "Provider=mrOleDB.Provider.2; _
    Data Source=mrDataFileDsc; _
    Location=C:\Program Files\IBM\SPSS\DataCollection\7\
        DDL\Data\Data Collection File\museum.ddf; _
    Initial Catalog=C:\Program Files\IBM\SPSS\DataCollection\7\
        DDL\Data\Data Collection File\museum.mdd"
  SelectQuery = "SELECT * FROM VDATA "
End InputData

Source OutputDataSource(myOutputDataSource)
  ConnectionString = "Provider=mrOleDB.Provider.2; _
    Data Source=mrRdbDsc2; _
    Initial Catalog=''; _
    Location='Provider=MSOLEDBSQL.1; _
      Integrated Security=SSPI; _
      Persist Security Info=False; _
      Initial Catalog="+DataCollectionDBName+"; _
      Data Source="+DataCollectionRDBServer+"'; _
    MR Init Project="+DataCollectionDBName
  MetaDataOutputName = RDBMetaDataFile
End OutputDataSource

  Path = "c:\temp"
  Group = "DMGR"
  Alias = "Tester"
  FileSize = 500
End Logging

Dim CognosServerURl

CognosServerURl =
Dim CognosExposer, ConfigrationSetting

'Used to expose to Cognos
Set CognosExposer = CreateObject("ExposeToCognos.Exposer")
'Specify Data collection RDB2 data. It should be based on SQL server authentication when a new Cognos datasource needs to be built
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 = RDBMetaDataFile
CognosExposer.MetadataVersion = "{..}"

'Specify Cognos Data Source if based on SQL Server 2012
CognosExposer.CognosDataSourceForCaseData.Provider = "SQLNCLI11"

'Specify Dimension / Measure questions to be exposed
'If not specify Dimension and Measure questions, all questions
'will be exposed to congos
CognosExposer.SystemVariableSelection = 0

'Specify Cognos Server URL and credentials
CognosExposer.CognosServerURL = CognosServerURl
CognosExposer.CredentialsForLoginCognos.Anonymous = true

'Expose to Cognos Server
CognosExposer.CreatePackage(CognosPackage, CognosDataSource,"")
End Event
Publishing data