List out all coldfusion datasources along with username and password.

Posted by Bharat Patel on August 27, 2010
  0 comments

Hello Friends,
    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>

Comments


Leave a comment

Tell us about yourself
Your Name     (required field)
Your Email Address     (required field)
Website URL      
Comment and preferences
Your Comment  
   
  Subscribe to this comment thread