Skip to main content
This topic has been closed for replies.

1 reply

Participant
October 24, 2012

The original documentation has been incorrect since CF 8... Since 2007 and they keep rolling the incorrect documents forward to the next version.  5 years later...

You need to create a new user in the CF Admin and assign the appropriate roles to the user to allow this to work.

<cfscript>

writeOutput("Installing ODBC Services...<br>");

createObject("component","cfide.adminapi.administrator").login("password","username"); 

myObj = createObject("component","cfide.adminapi.datasource");

returnValue = myObj.installODBCservice();

writeOutput("ODBC Services installed");

</cfscript>

Inspiring
October 26, 2012

In such scenario, It is always better to first remove existing/corrupted odbc services through a .cfm page containing below code snippet(with admin user password):-

<cfscript>

  //login using admin 

  //createObject("component","cfide.adminapi.administrator").login("administrator_password");

  createObject("component","cfide.adminapi.administrator").login("password");      

  //instantiate datasource object

  myObj = createObject("component","cfide.adminapi.datasource");

</cfscript>

TO REMOVE ODBC SERVICES:

<cfscript> 

     writeOutput("Removing ODBC Services...<br>"); 

     returnValue = myObj.removeODBCservice(); 

     writeOutput("ODBC Services removed"); 

</cfscript>

Then install odbc services through a .cfm page containing below code snippet(with admin user password):-

<cfscript>

  //login using admin 

  //createObject("component","cfide.adminapi.administrator").login("administrator_password");

  createObject("component","cfide.adminapi.administrator").login("password");

  //instantiate datasource object

  myObj = createObject("component","cfide.adminapi.datasource");

</cfscript>

TO Install ODBC Services:

<cfscript> 

         writeOutput("Installing ODBC Services...<br>"); 

         returnValue = myObj.installODBCservice(); 

         writeOutput("ODBC Services installed"); 

</cfscript>

You can also put both scripts codes within single script tag for each purpose.

Message was edited by: KaifAkbar