Contact Us

Let us know to help you out quickly!

 Bharat Patel     Feb,08 2017

List Out All Coldfusion Data Sources Along with Username and Password

Using ColdFusion service Factory we can take all details of data sources, database, username, class, map details (database role), driver.The following code can be used to list out data sources along with username and decrypted passwords. I hope it may be useful to you.

<cfset objDS = createobject("java","coldfusion.server.ServiceFactory").getDatasourceService().getDatasources() /><cfoutput><table border="1" cellpadding="3" cellspacing="0" width="50%"><tr><th><b>DataSource</b></th><th><b>Username</b></th><th><b>Password</b></th></tr><cfloop collection="#objDS#" item="Key"><cfif len(objDS[Key]["password"])><cfset password = Decrypt(objDS[Key]["password"],generate3DesKey("0yJ!@1$r8p0L@r1$6yJ!@1rj"), "DESede","Base64") /><tr><td>#objDS[key].name#</td><td>#objDS[key].username#</td><td>#password#</td></tr></cfif></cfloop></table></cfoutput>