If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

DataSource ConnectionString change in .NET

Started by EarthDog, 15 Nov 2014 01:34:21 PM

Previous topic - Next topic

EarthDog

I have just downloaded the SDK and did a quick and dirty search on how to get my datasources.

Ultimately i want to change the SERVER in some of them.

How  would do it?


private void button1_Click(object sender, EventArgs e)
        {
            var biCMS= new contentManagerService1();
            biCMS.Url = "http://bidev:9300/p2pd/servlet/dispatch";
            //
            System.Text.StringBuilder credentialXML = new System.Text.StringBuilder("<credential>");
            credentialXML.AppendFormat("<namespace>{0}</namespace>", "xxxxxx");
            credentialXML.AppendFormat("<username>{0}</username>", "xxxxxxx");
            credentialXML.AppendFormat("<password>{0}</password>", "xxxxxxxx");
            credentialXML.Append("</credential>");
            //
            string encodedCredentials = credentialXML.ToString();
            xmlEncodedXML xmlEncodedCredentials = new xmlEncodedXML();
            xmlEncodedCredentials.Value = encodedCredentials;
            searchPathSingleObject[] emptyRoleSearchPathList = new searchPathSingleObject[0];
            biCMS.logon(xmlEncodedCredentials, null);
            //
            propEnum[] props = new propEnum[] { propEnum.searchPath, propEnum.defaultName, propEnum.connectionString };
            propEnum[] dataConnectionProps = new propEnum[] { propEnum.defaultName, propEnum.connectionString };
            sort[] s = new sort[] { new sort() };
            s[0].order = orderEnum.ascending;
            s[0].propName = propEnum.defaultName;
            queryOptions qo = new queryOptions();
            StringBuilder output = new StringBuilder();
            searchPathMultipleObject packagePath = new searchPathMultipleObject();
            packagePath.Value = "CAMID(\":\")/dataSource/*";
            var ret = biCMS.query(packagePath,props,s,qo );
            baseClass[] ret1 = null;
            foreach (var baseClass in ret)
            {
                packagePath.Value = baseClass.searchPath.value + "//dataSourceConnection";
                ret1 = biCMS.query(packagePath,dataConnectionProps,s,qo );
                TextBox1.Text += "\n" + baseClass.defaultName.value;
                foreach (dataSourceConnection con in ret1)
                {
                    TextBox1.Text += " - " + con.connectionString.value;
                }
            }
        }



Andrew Weiss

EarthDog,

MetaManager's Object Editor has this capability.  It's part of the advanced section, but we can perform a Find / Replace on the connectionString property of datasourceConnection objects in bulk.  There's some information and a video of the module located here:
http://www.bspsoftware.com/Products/MetaManager/Update#OE

Feel free to download the MetaManager trial and check out the module.  If you're interested I can show you how to set up Object Editor to do the job that you need. Feel free to email me at andrew.weiss@avnet.com

Thanks,
-Andy
MetaManager makes administering IBM Cognos a breeze.  http://www.bspsoftware.com/MetaManager