Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » UltraLite - Java Programming » UltraLiteJ application development


How to close an UltraLite Java edition database connection

An UltraLite Java edition database closes when all the concurrent connections have been released. You can release all the connections using the DatabaseManager.release method.


Use the Connection.release method to release the current connection.

If a BlackBerry application crashes before it can release its active database connections, a ULjException object with the SQLE_FILE_IN_USE error code may be thrown when the application attempts to reconnect to the database. In this scenario, you must reboot the smartphone so that the application can reconnect.

To avoid a reboot, a catch-all exception handler should be used to call the emergencyShutdown method so that the connections are released.

For example, the following catch-all exception handler can be used in a BlackBerry application to call the emergencyShutdown method when an unrecoverable error occurs:

try { 
    // top level application code 
    // release all connections in a normal termination 
} catch( Exception e ) { 
    throw e;

This example assumes that the conn object represents an active connection to an UltraLite Java edition database.

 See also