-
1. JMS Rollback and Oracle Database.
h.wolffenbuttel May 5, 2011 9:24 AM (in response to henrique.malheiro)You could register a new datasource to get a new connection to handle your transaction. Something like:
public static Connection getConnection() throws SQLException {
Context c = null;
if (jdbcFactory == null) {
try {
c = new InitialContext();
jdbcFactory = (DataSource) c.lookup("java:jdbc/YourConnectionDS");
}
catch (NamingException e) {
throw new SQLException(e.getMessage());
}
}
return jdbcFactory.getConnection();
}
Regards,
Hans
-
2. JMS Rollback and Oracle Database.
henrique.malheiro May 5, 2011 10:01 AM (in response to h.wolffenbuttel)Hi,
Thanks for your reply.
I have the action monitor implemented exactly as you suggested, with a new datasource. Neverthless, the database operations performed by the monitor action don't persist upon JMS rollbacks, which I don't understand why. How are the two related?
Best regards,
Henrique Malheiro
-
3. Re: JMS Rollback and Oracle Database.
ryanhos May 6, 2011 1:38 PM (in response to henrique.malheiro)I suspect that your new datasource is a local-tx or xa datasource. The new datasource should be a no-tx datasource. This page explains how to configure datasources. A local or XA datasource will provide connections that participate in an enclosing transaction, whereas a no-tx datasource does not utilize any of the container-provided transaction demarcation logic. It's often a good idea to have a single no-tx datasource available for performing operations like audit logging and other system-related tasks that should not fail a business transaction if the system task fails to execute.
In the event that you in fact do have a no-tx datasource configured, I'd ask you to examine your code to make sure you're actually committing the transaction and closing the connection.
I hope this has been helpful. If you need additional assistance configuring and consuming datasources, I ask that you seek help on the JCA message board, as the topics you're likely to ask about are not specifically ESB related.