How To Check For Database Connection

Hi.

I’m trying to check if a database connection exists (instance of database object) but i’m getting a unknownpropertyexceptions error.

is there a whay to check for a database connection?

i already tried to catch the exception, but it’s not working (maybe i’m doing it wrong)