Cloud CM-IPMP Instrukcja Naprawy Strona 125

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 201
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 124
For further information regarding extension deployment descriptors refer to Section 18.5 in Chapter 18.
The SBB is then able to obtain a reference to an object implementing the DataSource interface via a JNDI lookup as follows:
import javax.slee.*;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
...
public class SimpleSbb implements Sbb {
private DataSource ds;
...
public void setSbbContext(SbbContext context) {
try {
Context myEnv = (Context) new InitialContext().lookup("java:comp/env");
ds = (DataSource) myEnv.lookup("jdbc/ExternalDataSource");
} catch (NamingException xNE) {
//Could not set SBB context
}
}
...
public void onSimpleEvent(SimpleEvent event, ActivityContextInterface context,
Address address){
...
try{
Connection conn = ds.getConnection();
} catch(SQLException xSQL) {
//Could not get database connection
}
...
}
...
}
19.4.1 SQL Programming
When a SBB is executing in a transaction and invokes SQL statements, the transaction management of the JDBC connection
is controlled by the Rhino SLEE. This enables Rhino SLEE to perform the last-resource-commit optimisation as discussed in
section D.4 of Appendix D.
Invoking JDBC methods which affect transaction management have no effect or undefined semantics when called from an
application component isolated by a SLEE transaction.
The methods (including any overridden form) that affect transaction management on the
java.sql.Connection
interface are
as follows:
close
commit
rollback
setAutoCommit
setIsolationLevel
setSavePoint
releaseSavePoint
Open Cloud Rhino 1.4.3 Administration Manual v1.1 116
Przeglądanie stron 124
1 2 ... 120 121 122 123 124 125 126 127 128 129 130 ... 200 201

Komentarze do niniejszej Instrukcji

Brak uwag