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>
1 Correct answer
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.
- Open the ColdFusion Administrator. Go to the datasource page.
- Click to edit the datasource for which you are having the issue. Click on the button "Show Advanced Settings".
- Have a look at the "Maintain Connections" setting. Is its checkbox unchecked?
- If it is,, then that is probably the cause of the issue. Check the checkbox, and press the Submit
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.
Copy link to clipboard
Copied
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.
- Open the ColdFusion Administrator. Go to the datasource page.
- Click to edit the datasource for which you are having the issue. Click on the button "Show Advanced Settings".
- Have a look at the "Maintain Connections" setting. Is its checkbox unchecked?
- If it is,, then that is probably the cause of the issue. Check the checkbox, and press the Submit button.
- 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.

