Skip to main content
August 10, 2016
Question

Can't get password string from DB in coldfusion 11 but it works well in coldfusion8

  • August 10, 2016
  • 1 reply
  • 609 views

The below shown code works well on CF8. password can get from DB successfully. But it doesn't work on CF11. It can't retrive password from DB. Password is always empty. username and datasource can get from DB. The password stored in DB is displayed as:

0-8VB>D;.<MQ95X$(5M2$>P  

I guess maybe CF11 variable can't store complex/special string? How to save it? I need get password from DB and then decrypt it.

<cfquery datasource="#XXXX#" name="GetConfig">

SELECT S.A

,IsNull(ds.column_a, '') AS DataSource

,IsNull(un.column_a, '') AS Username

,IsNull(pw.column_a, '') AS Password

FROM (SELECT column_a AS A FROM table_a WHERE column_b='xxxx1') s

LEFT JOIN table_a ds ON ds.column_b='xxxx2'

LEFT JOIN table_a un ON un.column_b='xxxx3'

LEFT JOIN table_a pw ON pw.column_b='xxxx4'

</cfquery>

<cfset qDataSource = GetConfig.DataSource />

<cfset qUsername = GetConfig.Username />

<cfset qPassword = GetConfig.Password />

<cfoutput>

<p>datasource:#qDataSource#</p>

<p>username:#qUsername#</p>

<p>password:#qPassword#</p>

</cfoutput>

    This topic has been closed for replies.

    1 reply

    EddieLotter
    Inspiring
    August 10, 2016

    If you copy the text of that query and execute it in a query utility provided by the vendor of your database engine, does the query return a result?

    Cheers

    Eddie

    August 11, 2016

    Yes the query can return result successfully. I can see the password is 0-8VB>D;.<MQ95X$(5M2$>P  from return result. I defined a vairable qPassword and set value as returned password. But it show nothing when I use cfoutput to print it.

    EddieLotter
    Inspiring
    August 11, 2016

    Okay, if the query works exactly as portrayed in your post then immediately after the <cfquery> closing tag, add the statement <cfdump var="#GetConfig#"> and let us know what you see.

    Cheers

    Eddie