What causes "Stored procedure '<procedure_name>' may be run only in unchained transaction mode" in EAP 6 ?

Solution In Progress - Updated -

Issue

java.sql.SQLException: Stored procedure 'sp_trunc_temp_tables' may be run only in unchained transaction mode. The 'SET CHAINED OFF' command will cause the current session to use unchained transaction mode.

The exception above is raised when performing the steps below:

  1. The following was run against a Sybase database
    • create procedure sp_trunc_temp_tables as begin exec ('TRUNCATE TABLE emp') end;
  2. The class below was used to execute the procedure on startup/deploy:
@Singleton(name = "SybaseTruncInitializer")
@TransactionManagement(TransactionManagementType.CONTAINER)
@Startup
public class SyBaseTruncInitializer {

    @Resource(mappedName="java:/datasources/SybaseDS")
    private DataSource datasource;

    @PostConstruct
    public void init() throws Exception {
        trunc();
    }

    private void trunc() throws SQLException {
        String proc = "{call sp_trunc_temp_tables}";
        Connection con = null;
        CallableStatement cs = null;
        try {
            con = datasource.getConnection();
            cs = con.prepareCall(proc);
            cs.execute();
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            if (cs != null) {
                cs.close();
            }
            if (con != null) {
                con.close();
            }
        }
    }
}

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6
  • Sybase 15

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.