Skip to main content
Participant
Jan 8, 2021 6:34 PM UTC
Question

Coldfusion to Azure sql, Connection retry logic implementations?

Hi 

Just wondering if anyone has any experience with implementing connection retry logic with Coldfusion and Azure sql, to handle transient connection failures. I have an application that is hosted on Azure with Azure SQL and there have been a few instances where the DB has failovered intermittently while a user was requesting a page, thus resulting in an error. Looking to see how I can minimize this impact and make it a seamless experience on the user's end when this occurs. I've looked at https://docs.microsoft.com/en-us/ef/ef6/fundamentals/connection-resiliency/retry-logic which is based on an EF6 library.

 

Thanks!

    4 replies

    S15Author
    Participant
    Jan 11, 2021 9:49 PM UTC

    Thanks for the suggestions guys.. I've added what you suggested Dave to the onRequestStart method of the application.cfc so will monitor and see how it goes with handling the issues.

    Translate
    AlHolden
    Inspiring
    Jul 17, 2025 8:50 PM UTC

    I know it's been forever since this thread was abandoned, I found it while looking for answers to a similar issue.

    But once again, I find a comment in which someone has created some code for their own problem, and also decided not to share it. I'd be angry... but I'm probably guity of the same habit. ;-]


    I will travel on. Who knows, perhaps my continuing search or AI results will teach me that CF or JDBC options have gotten better at leveraging Azure SQL's built-in retry logic in the past 4 years.

    Translate
    BKBK
    Community Expert
    Community Expert
    Jan 9, 2021 7:11 PM UTC

    2 suggestions in addition to Dave's:

    1. ensure that Maintain Connections is enabled for the datasource.
    2. use the cachedWithin attribute for queries that do not change often; ColdFusion would then use the value from cache rather than make another trip to the database.
    Translate
    Community Expert
    Jan 9, 2021 2:39 PM UTC

    CF's database interaction is typically not as low-level as the code you're showing. But there's no reason why you couldn't handle connection failures at a higher level using CFTRY/CFCATCH or even higher-level error handling. If this happens a lot, there's no reason why you couldn't build a wrapper that lets you try a database connection, catch a connection failure caused by this behavior, wait briefly if needed, then retry the database connection. Presumably if you have the same problem a second time you'd want to respond with an actual error state, I guess.

     

    Dave Watts, Eidolon LLC

    Translate
    Dave Watts, Eidolon LLC