Software Technology Tips

Usually if we need to do some setting changes for ColdFusion application server then we log into ColdFusion Administrator using ColdFusion Admin GUI and change the settings. We can also do all the ColdFusion Administrator setting changes programmatically through ColdFusion Administrator API calls. ColdFusion provides us with around 12 components for different sections of the Administrator. We can call the different methods of different components to change the settings.

The basic component file containing the methods related to login and logout functionality for ColdFusion Administrator is "administrator.cfc". With the login method of this component, we can log into the Administrator by providing the ColdFusion Administrator login password. Once we log in, we can use the other methods of the components to perform other functionalities like creating datasource, creating mapping, modifying the debugging output settings etc.


Sample Example to create one ColdFusion datasource for SQL server with Administrator API call: 

<cfscript>
 // Create an object of administrator component and call the login method
 adminObj = createObject("component","cfide.adminapi.administrator");
 adminObj.login("CFADMIN Password will go here");


 // Create an object of datasource component
 dsnObj = createObject("component","cfide.adminapi.datasource");


 // Setting up the parameter values for datasource
 stDSN = structNew();
 stDSN.driver = "MSSQLServer";
 stDSN.name="Datasource name will go here";
 stDSN.host = "Database server name/IP will go here";
 stDSN.port = "1433";
 stDSN.database = "Database name will go here";
 stDSN.username = "Database access user name will go here";
 stDSN.password = "Database access password will go here";
 stDSN.description = "Datasource description will go here";


 // Create MSSQL datasource
 dsnObj.setMSSQL(argumentCollection=stDSN);


 // Call logout method
 adminObj.logout();
</cfscript>


</o:p>

For more information please visit: http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=basiconfig_37.html


Related Tags:

ColdFusion

Author: Sankalan Panda

Related Pages

  • Coldfusion Development Expertise
  • Coldfusion Custom Projects

ColdFusion

Let us Connect!

iso 9001 QA25 Red Herring STPI D&B Fastest Growing SME 2013 Award zinnov Nasscom

This site uses cookies. We respect your privacy.copyright (c) Mindfire Solutions 2007-2015. Login