Highlighted

Application holds on to an old datasource

Participant ,
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.

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,

^_^

Views

200

Likes

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

Application holds on to an old datasource

Participant ,
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.

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,

^_^

Views

201

Likes

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

^_^

Likes

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
Reply
Loading...
Jun 23, 2016 0
Participant ,
Jun 24, 2016

Copy link to clipboard

Copied

Thank you!  That did the trick.

Likes

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
Reply
Loading...
Jun 24, 2016 0
LEGEND ,
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,

^_^

Likes

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
Reply
Loading...
Jun 24, 2016 0
Most Valuable Participant ,
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().

Likes

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
Reply
Loading...
Jun 24, 2016 1
LEGEND ,
Jun 24, 2016

Copy link to clipboard

Copied

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

V/r,

^_^

Likes

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
Reply
Loading...
Jun 24, 2016 0