The question says it all: I want to change information about datasources on multiple coldfusion servers. Can this be scripted? Ideally, a solution would work on both CFMX 6.1 and CF8
views:
79answers:
2what's the fastest way to change datasource passwords for an entire farm of servers in coldfusion?
Can you use the API cfc's for version 8
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=basiconfig%5F37.html
With 6.1 I think you are out of luck. It stores the password in an XML file somewhere I believe, you'd have to read it in change it and save. That would work for both versions.
Well, you could write an application that makes use of the Admin API and use the CFIDE/adminapi/datasource.cfc, but that won't work in CFMX 6.1 because Admin API didn't exist then, so you'd have to use the unsupported ServiceFactory instead.
On the other hand, a hackish approach (a hack that I would actually use) is to first create a temp datasource with the new password then read the neo-datasource.xml (CF8) or neo-query.xml (CFMX 6.1) to get the encrypted version. Then find the encrypted version of the password that already exists that you wish to change. Then simply do a string replace in those XML config files for each server where you find the existing encrypted password and replace it with the new encrypted version. It will work fine, but do the swap while CF is shutdown coz it keeps a copy of the existing passwords in memory and will need to re-read the xml config files.