ColdFusion Software Development Company ColdFusion Software Development Company

How to Restore DataSource credentials on ColdFusion 9

I know that some sites still use old versions of ColdFusion, for example, ColdFusion 9. However, through my experience helping clients, it’s surprising to find that the actual number of sites running on ColdFusion is so massive.

Adobe hasn’t supported this version of ColdFusion since 12/31/2014 and those sites are usually hosted on the old versions of Windows. And Microsoft doesn’t support it too.

It generates a lot of security problems- we can’t use the newer version of Java, etc.

Adobe provides very clear migration instructions, for example: And most cases we can migrate sites with small code updates or without any code change.

In many cases, we are not able to make a migration. We need to copy scripts to the new hosting, setup DataSources etc.

And because we deal with very old sites often created by another developer we can have a situation when nobody has a database password.

But, if we know the ColdFusion admin password and datasource name we can retrieve all information:

<h1>ColdFusion Datasources</h1>

<cfset version=createobject(“java”,”coldfusion.server.ServiceFactory”).LicenseService.getMajorVersion()>

<cfset form. version =variables. version >

<cfif NOT isdefined(“form.adminpassword”) or (isdefined(“form.adminpassword”) AND NOT len(form.adminpassword))  or (isdefined(“form.dsn”) AND NOT len(form.dsn))>

    <cfif (isdefined(“form.adminpassword”) AND NOT len(form.adminpassword)) or  (isdefined(“form.dsn”) AND NOT len(form.dsn))>

        <font color=”#FF0000?>The password and Datasource Name cannot be empty!</font>




    <form action=”<cfoutput>#cgi.script_name#</cfoutput>” method=”post”>

        Enter the CF Admin Password: <input type=”password” name=”adminPassword”><br />

                                Enter the Datasource Name: <input type=”text” name=”dsn”><input type=”submit” value=”Submit”>



    <cfset adminauth=createObject(‘component’,’CFIDE.adminapi.administrator’).login(‘#form.adminpassword#’)>

    <cfif NOT adminauth>

        <font color=”#FF0000?>The password was incorrect!</font><br>

        <form action=”<cfoutput>#cgi.script_name#</cfoutput>” method=”post”>

            Enter the CF Admin Password: <input type=”password” name=”adminPassword”><input type=”submit” value=”Submit”>




<cfif isdefined(“form.adminpassword”) and isdefined(“form.dsn”)>

    <cfoutput>ColdFusion Verion: #variables.version#<br><br></cfoutput>

    <cfif isDefined(“variables.version”) AND variables. version LTE 9>

        <!— Create datasource object —>

        <cfset variables.datasourceObject=createobject(“java”,”coldfusion.server.ServiceFactory”).getDatasourceService().getDatasources()>

<table border=”1? cellpadding=”5? cellspacing=”0?>

            <tr bgcolor=”c0c0c0?>








            <cfset variables.datasource = form.dsn>

            <cfif len(variables.datasourceObject[variables.datasource][“password”])>

                <cfset variables.database =”>


                 <cfset variables.username = variables.datasourceObject[variables.datasource][“username”]>

                <cfset variables.driver = variables.datasourceObject[variables.datasource][“driver”]>


                      <cfset variables.database = variables.datasourceObject[variables.datasource].urlmap.CONNECTIONPROPS.database>

                      <cfset = variables.datasourceObject[variables.datasource]>

                       <cfcatch type=”any”>



                <cfset variables.decryptedPassword = Decrypt(variables.datasourceObject[variables.datasource][“password”],generate3DesKey(“0yJ!@1$r8p0L@r1$6yJ!@1rj”),”DESede”,”Base64?)>

                <!— Output datasource information —>














If you have questions or need help with this, don’t hesitate to reach out to me and I’ll be happy to assist.


We would love to help.
Give us a call:

(718) 793-2828

Get a free project estimate:

Recent Comments