SybSQLException 'command not allowed within multi-statement transaction' in EAP 6

Solution Verified - Updated -

Issue

  • Deployed an initializer to truncate a Sybase table on startup:
@Startup
@Singleton(name = "SybaseTruncInitializer")
public class SybaseTruncInitializer {

    @Resource(mappedName = "java:jboss/datasources/my-sybase")
    private DataSource datasource;

    @PostConstruct
    public void init() throws Exception {
        Connection con = datasource.getConnection();
        try {
            CallableStatement cs = con.prepareCall("{call sp_trunc_temp_tables}");
            try {
                cs.execute();
            ...
  • Sybase raises the exception below:
com.sybase.jdbc4.jdbc.SybSQLException: TRUNCATE TABLE command not allowed within multi-statement transaction.

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.