Managing Device Database Connections

Use the openConnection and closeConnection methods generated in the package database class to manage device database connections.

Note: Any database operation triggers the establishment of the database connection. You do not need to explicitly call the openConnection API.

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 is most likely already established and is immediately available to the user.

All ConnectionProfile properties should be set before the first access to database, otherwise they will not take effect.

The closeConnection method closes all database connections for this package and releases all resources allocated for those connections. This is recommended to be part of the application shutdown process.