Closing a database
In order to close a database your application should implement the following steps:
1. Call the closeDatabase action of the Connection event (for the open database) with the name of the callback action.
2. Create a handler action for the closeDatabase callback action.
The definitions for the two forms of the closeDatabase action are:
action closeDatabase(
action <Connection, string> callback)
and
action closeDatabaseFull(
boolean force,
dictionary<string,string> extraParams,
action<Connection,string> callback)
The relevant code in the samples\adbc\api-example\ADBC_Example.mon file is similar to this:
com.apama.database.Connection conn :=
new com.apama.database.Connection;
// ...
conn.openDatabase(serviceId, results[0].dbUrl, "",
handleOpenDatabase);
// ...
conn.closeDatabase(handleCloseDatabase);
action handleCloseDatabase(com.apama.database.Connection conn,
string error)
{
if error.length() != 0 then {
log "Error closing database " + getDbName() + ": " +
error at ERROR;
}
else {
log "Database " + getDbName() + " closed." at INFO;
}
}
Copyright © 2013
Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.