Managing Device Database Connections

Use the OpenConnection() and CloseConnection() methods generated in the package database class to manage device database connections.

The OpenConnection() method checks that the package database exists, creates it if it does not, and establishes a connection to the database. This method is useful when first starting the application: since it takes a few seconds to open the database when creating the first connection, if the application starts up with a login screen and a background thread that performs the OpenConnection() method, after logging in, the connection already exists and is immediately available to the user.

The CloseConnection() method closes the current database connection, and releases it from the used connection pool.