Get Default Database Connection of Perspective Project from the Client

Hi all,

I am currently attempting to get the default database connection name from a Perspective window; however, I am running in to an issue.

The following script will run fine from a button press on a Vision window:

logger = system.util.getLogger(‘test’)
connectionInfo = system.db.getConnectionInfo()’%s’%connectionInfo.getValueAt(0,‘Name’))

returning the default database connection name for that project.

However, if I try to run the same script on a Perspective window, I get the following error:

getConnectionInfo(): expected 1 args; got 0

It seems in the Ignition 8.0 documentation that I should be able to use getConnectionInfo() with no arguments, and it will return the default database connection info. Am I missing something here? If this can’t be used within a Perspective window, does anyone have any suggestions for how to obtain the default database connection name?


Vision has an overload of getConnectionInfo() that takes no arguments and returns info for the default datasource for the project.

Although Perspective knows what project it’s in, it looks like we’re just defaulting to the Gateway version, which requires the name of the datasource you want to use. I’ll check and see if we’ve opened a bug ticket for this.

Thanks Kathy. I thought in the meantime, we might be able to achieve this through grabbing the project name and querying the Ignition internal database for which database connection was associated with that project. Is that possible? I found a list of our database connections inside the DATASOURCES table; however, our Perspective projects do not appear in the PROJECTS table.

If it is possible to find a list of Perspective projects linked to their database connections in the internal database, could you direct me to which tables to look at?


The default connection for a project is not stored in the internal database any more. Instead, it’s in the global props resource, stored on disk, but it’s not stored in a way that you’ll be able to access it. (We have that planned for the future, but it’s not a high priority.)