Can I use a script to reconnect a database?

We have a database that is valid, but sometimes it gets to a status that says Reconnecting. The way to fix this is to edit the connection and save, then it will become Valid again. This is nice, but it relies on my mouse clicking something. Is there a way to do this automatically when I get the connection error? I would need to detect that the database is in error or FAULTED as the log says.


See system.db.getConnectionInfo and system.db.setDatasourceEnabled

Those functions should enable you to detect the DB is down, and the reset the connection.

1 Like

Thanks, this works. Running this script every hour is no issue.

I have a problem on Ignition 7.9.6
com.inductiveautomation.ignition.designer.gui.tool’ object has no attribute ‘setDatasourceEnabled’
Is this a problem with the version? It is specified on the documentation, so what is it?

Why are you still using 7.9.6? That version is years out of date. That said, the function should still exist. What’s the actual script you’re using?

Sometimes you set up a application for a client and it works well for years, so there’s no need or want to update, why fix what isn’t broken. This leads me to dealing with some projects that are 7.4 or less of Ignition. I don’t think most developers have much say in what version we’re using unfortunately.

Appreciated, but if you start having a problem that you think might be a bug, the first thing we’re going to tell you is update, because it’s in everyone’s best interest to find out if a bug is already fixed before spending time troubleshooting or investigating further.


So I updated my version from 7.9.6 to version 7.9.14 which is the lates that the licence will have. Also installed the Vision module as I had previous experience with some script not able to run without that module installed, a bug in Ignition on how they package their code base.

The function is working now, so i’ll see if the future I have no more bug due to the jdbc driver.