Skip to main content
June 23, 2016
Answered

Application holds on to an old datasource

  • June 23, 2016
  • 1 reply
  • 721 views

I had a similar problem in this thread:  Finding the Oracle datasource...

I have a CF 10 application interfacing with an Oracle 11g database; Windows Server 2012.   The original developers had different names for the datasources for Test (abcdTest) and Production (abcdProd).   I attempted to access Test after being on another project for quite a while and received the message that the datasource abcdProd could not be found... that is correct because I was logged into the Test machine.   I searched my source code and for some reason the datasource abcdProd was assigned in numerous places in the Application.cfc.   I changed all the references, cleared cache, restarted the browser and tried to login again.  Same error.  There are no references to abcdProd in the code base I am currently working with.   I have verified with the Gov't SysAdmin that CF Admin is set up correctly and my code should be pointing to abcdTest.   But it is not.  I can't seem to get it to recognize abcdTest.  I an hoping the CF server doesn't need to be restarted.  I requested that during the above mentioned thread and was told, "there are 50 other applications on this machine and none of them require what you require.  The restart will have to be scheduled", so unless that is the only way to fix it, I'd like to avoid that option.  Has anyone had this problem?  What was done to fix it?  Thank you.

This topic has been closed for replies.
Correct answer WolfShade

If you have access to and can change your application.cfc, add the following code to the very start (after any arguments, of course) of your onRequestStart() function:

<cfif StructKeyExists(url,'reinit') AND trim(url.reinit) eq "true">

    <cfset onApplicationStart() />

</cfif>

And then load the page with http : //www. domain. com/page.cfm?reinit=true

This will reinitialize the application scope without rebooting the server.

Next, I would do a site-wide search for "abcdProd" to make sure it's not being set, elsewhere (you only indicated that it wasn't in application.cfc.)

HTH,

^_^

1 reply

WolfShade
WolfShadeCorrect answer
Legend
June 23, 2016

If you have access to and can change your application.cfc, add the following code to the very start (after any arguments, of course) of your onRequestStart() function:

<cfif StructKeyExists(url,'reinit') AND trim(url.reinit) eq "true">

    <cfset onApplicationStart() />

</cfif>

And then load the page with http : //www. domain. com/page.cfm?reinit=true

This will reinitialize the application scope without rebooting the server.

Next, I would do a site-wide search for "abcdProd" to make sure it's not being set, elsewhere (you only indicated that it wasn't in application.cfc.)

HTH,

^_^

June 24, 2016

Thank you!  That did the trick.

WolfShade
Legend
June 24, 2016

Glad I could help.  And, thank you for marking my answer as correct.  I do appreciate it.

V/r,

^_^