1 Reply Latest reply on Jul 31, 2009 9:37 AM by Jim-sama

    AdminAPI datasource disable?

    Jim-sama

      How would I disable, then enable a datasource (mssql datasource) via the adminapi? So far it looks like i'd have to setmssql(), overwriting the existing entry?

        • 1. Re: AdminAPI datasource disable?
          Jim-sama Level 1

          keep getting:

           

          dsn=MyDSN

           
          The error occurred in datasource.cfc: line 1510
          Called from setdsn.cfm: line 25
          Called from setdsn.cfm: line 6
          Called from datasource.cfc: line 471

           

          <cfscript>
          cAdmin = createObject("component","cfide.adminapi.administrator");
          cAdmin.login('mypass');
          ds = createObject("component","cfide.adminapi.datasource");
          ds1 = ds.getdatasources();

          dbopts = structnew();
          dbopts.name = ds1['myDSN']['name'];
          dbopts.host = ds1['myDSN']['urlmap']['connectionprops']['host'];
          dbopts.database = ds1['myDSN']['urlmap']['connectionprops']['database'];
          dbopts.selectmethod = ds1['myDSN']['urlmap']['connectionprops']['selectmethod'];
          dbopts.originaldsn = ds1['myDSN']['name'];
          dbopts.disable = true;

           

          // ds.setMSSQL(name = dbopts.name, host = dbopts.host, database = dbopts.database, selectmethod = dbopts.selectmethod, originaldsn = dbopts.originaldsn, disable = dbopts.disable);

          ds.setMSSQL(argumentCollection=dbopts);
          </cfscript>