Database connection Faulted - Errors list

I have some database connections running and I'd like to have some warnings when they are disconnected.

My struggle is to define when it's ok to be faulted or not. These connections are linked to a machines that turn off every day at end of shift. And sometimes during shift are restarted.

I'd like to have a list of what kind of errors function system.db.getconnectionInfo(0,'Problem') could return, so I can filter and ignore the ones caused because machine is turned off.

Also I'd like to advise just once when there is an error, not all times state is faulted after a "reconnecting" state.

I've solved some of these requirements, but I still get an advise every time machine is turned off.

Is there a list of errors of db connections, so I can do some filter with the string?

thanks,

Is there a way you can set up a schedule for when a machine is expected to be turned off for the end of a shift and then add some logic to only trigger the alarm notification if the machine is not expected to be offline when it is triggered?

So if the alarm is triggered when it detects an issue with getconnectionInfo, it will first check if the machine is scheduled to be offline before triggering the actual alarming/notification.

I think the Problem result can be a variety of things depending on your driver or database that you check the getconnectionInfo on. You could try logging the machines for a week or so and have it record the different results of getconnectionInfo(Problem) and getconnectionInfo(Status) at the same time to see if there are any key differences vs a restart or shutdown etc. The Status is forced to be either Valid, Faulted, or Reconnecting; but Problem can be a ton of options.

Sorry if this isn't super helpful, maybe someone else will come along that knows a bit more about it.

There's no fixed list, as different JDBC drivers all have there own error messages. Also, the only reliable point to trap errors is in scripted calls to perform database operations, where you use a double except clause. Something like this in a project library script:

from java.lang import Throwable

def someProcessingFunction(someArgument):
    # ....
    try:
        result = system.db.runPrepQuery(....)
    except Throwable, t:
        # handle java and jdbc errors here
    except Exception, e:
        # handle jython errors here