• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Application holds on to an old datasource

Participant ,
Jun 23, 2016 Jun 23, 2016

Copy link to clipboard

Copied

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.

Views

375

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 23, 2016 Jun 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 bein

...

Votes

Translate

Translate
LEGEND ,
Jun 23, 2016 Jun 23, 2016

Copy link to clipboard

Copied

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,

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 24, 2016 Jun 24, 2016

Copy link to clipboard

Copied

Thank you!  That did the trick.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 24, 2016 Jun 24, 2016

Copy link to clipboard

Copied

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

V/r,

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 24, 2016 Jun 24, 2016

Copy link to clipboard

Copied

You might also add <cfset ApplicationStop()> right above <cfset onApplicationStart()>.  This will force the entire application to stop and restart entirely, not just call the code within onApplicationStart().

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 24, 2016 Jun 24, 2016

Copy link to clipboard

Copied

LATEST

Yep.. they added that in CF9.  I keep forgetting about that one.

V/r,

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation