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

Flush active database connections

Community Beginner ,
Oct 14, 2011 Oct 14, 2011

Is there any way to clear all cached database connections, i.e., those with 'Maintain Connections' enabled?  I'd like to do this without:

  1. Restarting the ColdFusion Application Server service
  2. Having to use the cfide.adminapi.datasource API to update every data source
  3. Disabling persistent connections (the Maintain Connections setting on the data source)

The first option would terminate all sessions.  The second option requires disabling and re-enabling the 'pooling' attribute on every data source.  The third option would impact performance.

CF 4.x and 5.x had an undocumented function called 'cfusion_dbconnections_flush()' that served this purpose but it no longer exists.

Background:  we use a lot of Oracle packages and sometimes they need to be recompiled.  The first time a recompiled package is invoked by a CFML template it will throw the exception 'ORA-04068: existing state of packages has been discarded'.   After the initial error the package is fine and executes normally.   When persistent connections are disabled the error does not occur at all.   We are using ColdFusion 9.0.1 on Windows 2003/IIS.

Thanks,

Michael Mongeau

Stratus Technologies

  Maynard MA

1.9K
Translate
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
Community Beginner ,
Oct 27, 2011 Oct 27, 2011

i think the option 3 is the best (i use this solution too, when needed), you can disable the persistent connection and re-enable, just to close all the active connections.. the performance impact should be quite slow(you are not using the persistent connections only for 1-3 seconds), but you have to do it for each datasources anyway..

Translate
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
Community Beginner ,
Oct 27, 2011 Oct 27, 2011
LATEST

My intent for option 3 was to permanently disable the persistent connections, which is why I discounted it.   I agree that temporarily disabling and then re-enabling the setting is the only option right now, and it does solve the problem.  It's not the best solution though, because often an Oracle package may be invoked by multiple data sources, and the administrator needs to be aware of which data sources need to be updated.

The application server obviously knows how to clear the active connections because does it when the Maintain Connections setting is toggled. How hard would it be to have an Admin feature to clear all active connections?  How about it Adobe?   It would be nice feature to put in the next release.

Translate
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