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

Database Issue - CFCATCH/CFTRY

Participant ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

I have an application that periodically throws this error

Error Executing Database Query.Communications link failure The last packet successfully received from the server was 878,178 milliseconds ago. The last packet sent successfully to the server was 18,954 milliseconds ago. The specific sequence of files included or processed is:  .......

I think this is because the DB is on a different server.
Is there any suggestions on how to fix this issue. 

The error occurs periodically.

If the DB issue cant be fixed could I use cfcatch.cftry to keep trying until the connection doesnt fail?

Maybe like this

 

<cftry>
Problem DB query goes here
    <cfcatch ...>
        <cftry>
          TRY DB query AGAIN?
            <cfcatch ...>
       TRY DB query AGAIN?
            </cfcatch
        </cftry>
    </cfcatch>
</cftry>

 

Views

139

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

Community Expert , Mar 22, 2024 Mar 22, 2024

I agree with @sdsinc_pmascari that you should look for a database solution, rather than a CFML solution. With regard to this, I have a suggestion.

 

  1. Open the ColdFusion Administrator. Go to the datasource page.
  2. Click to edit the datasource for which you are having the issue. Click on the button "Show Advanced Settings".
  3. Have a look at the "Maintain Connections" setting. Is its checkbox unchecked
  4.  If it is,, then that is probably the cause of the issue. Check the checkbox, and press the Submit
...

Votes

Translate

Translate
Engaged ,
Jan 31, 2024 Jan 31, 2024

Copy link to clipboard

Copied

Most of the time when I've seen that error it was due to the DB server or service being restarted.  I would focus on the DB issue.

 

The try-catch proposal you mentioned may work but is just a band-aid.  Best solve the actual problem. 

 

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
Community Expert ,
Mar 22, 2024 Mar 22, 2024

Copy link to clipboard

Copied

LATEST

I agree with @sdsinc_pmascari that you should look for a database solution, rather than a CFML solution. With regard to this, I have a suggestion.

 

  1. Open the ColdFusion Administrator. Go to the datasource page.
  2. Click to edit the datasource for which you are having the issue. Click on the button "Show Advanced Settings".
  3. Have a look at the "Maintain Connections" setting. Is its checkbox unchecked
  4.  If it is,, then that is probably the cause of the issue. Check the checkbox, and press the Submit button. 
  5.  If the checkbox is checked, then that is probably not the cause of the issue. The cause might be an outdated database driver. What is your database's driver version?
    Ensure that you have an up-to-date driver. Drivers usually have capabilities for connection-pooling, which help prevent communication failures.  

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