Reset Access Datasources Without Resetting ColdFusion

I am “stuck” with a few web applications that provide web front-ends to Access databases. I am not the owner of these databases, and for various reasons, the database owner will not upgrade it to SQL Server. Alas, this sometimes causes headaches like the following.

The Access databases are on a network fileserver. Occasionally, this server goes down or resets, and ColdFusion’s datasource connection to the database gets stuck in a disrupted state. I’ve come to learn two things you can try to get ColdFusion’s connection to the Access datasource working again without resetting the entire ColdFusion Application Server service, which is obviously disruptive to your entire site and all of its applications.

  1. Reset the ODBC services. The ColdFusion ODBC services (such as “ColdFusion 8 ODBC Agent” and “ColdFusion 8 ODBC Server”) actually handle the ODBC connections to DataDirect driver databases such as Microsoft Access databases. This is handy. Just reset these services and often connectivity is restored.
  2. Use the “Disable Connections” option in the datasource configuration. If you are using JDBC drivers (for instance, perhaps to connect to Microsoft Access 2007 databases), resetting the ColdFusion 8 ODBC Server service won’t help. Darn. However, if you go into the datasource’s configuration in ColdFusion Administrator, you can check the “Disable Connections” checkbox and submit the change. This will force ColdFusion to disconnect from the database. Immediately go back in and uncheck the checkbox and submit again. Your datasource will now have connectivity reestablished without a ColdFusion restart!

Happy days! The second option won’t be helpful to you if you have many, many datasources. However, this is better than a ColdFusion reset that would disrupt all of your apps.

8 Responses to “Reset Access Datasources Without Resetting ColdFusion”

  1. Joel Cox Says:

    You can also use the CF service factory to restart the datasources:

    I keep a page with this code handy to quickly restart the datasources if things go awry.

  2. Joel Cox Says:

    OK, that didn’t work…

    <cfobject type=”JAVA”
    action=”Create”
    name=”factory”
    class=”coldfusion.server.ServiceFactory”>
    <cfset dsService = factory.DataSourceService>
    <cfset dsService.restart() />

  3. Josh Says:

    Awesome. Thanks for sharing.

  4. Gus Says:

    It’s been a really, really long time since I’ve had to deal with this issue, but I know there was a time (pre cfmx) that if you wrote a query that errored out it would reset that datasource. It was a great little secret. I have no idea if it still works though.

  5. ColdFusion courses Says:

    great tips. I enjoyed reading this

  6. ColdFusion consulting Says:

    great article. I will bookmark this

  7. ColdFusion Consulting Says:

    ColdFusion offers a Simplified database access, which really helps me with workflow.

  8. ColdFusion Consulting Says:

    Great tips. Happy Holidays. http://www.on3solutions.com

Leave a Reply

  Theme Brought to you by Directory Journal and Elegant Directory.