Prior to PU21, if a SQL transient error occurred, an error will be thrown in X++ and there was no way to identify and catch it.
Starting from PU21, instead of throwing an error, an exception will be thrown with the type (TransientSqlConnectionError). This will give you the ability to catch and retry your outermost transaction in X++.
Before the exception was thrown, the AOS (kernel) has already retried the connection if the query is not within a transaction, hence you can use this exception and do your retries.
We recommend that you limit the number of retries so your code doesn’t get stuck if the Database takes longer time to recover.
For more details please see here
public static void LargeTransactionWrapper()
info(“Caught transient SQL connection error, ttslevel=” + int2Str(appl.ttsLevel()));
// At this point, transaction is canceled
// Code that indicates retry is possible
// Do clean up