tags:

views:

79

answers:

2

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

+3  A: 

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.

Kevin Schmidt
+2  A: 

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.

Steven Erat
wow. that's a hell of an approach, Steven. If they'll let me shut down CF, I might try this one.I wish I could accept both of these answersI was able to hook into the datasource service on MX, but it doesn't look like it exposes functionality for setting the password. In 8, it's exposed via getDatasource().getDatasourceDef()
marc esher