I'm getting below error while using JTA transaction. I have two datasources one for sybase database and other is for Oracle.
Also, I'm using jotm for JTA transaction. Server is Tomcat.
com.sybase.jdbc2.SybConnection: SET CHAINED command not allowed within multi-statement transaction.
(error code=0) --com.sybase.jdbc2.jdbc.SybSQLException: SET CHAINED command not allowed within multi-statement transaction.
Any idea why I'm getting below error on sybase?
I'm using Sybase thin driver com.sybase.jdbc2.jdbc.SybDriver and org.enhydra.jdbc.pool.StandardXAPoolDataSource.
Set chained is a transaction setting. Since you already have a transaction managed separately you are giving a conflicting command and the driver is throwing an error. The solution would be to not use "set chained" since XA is taking care of transactions for you.
Jeanne Boyarsky wrote: The solution would be to not use "set chained" since XA is taking care of transactions for you.
Jeanne: Before calling the actual database call, I have explicitly called the query:
but now the code is breaking at this line with the same exception. Sorry I didn't get you on that line.
Are you trying to say I should explicitly call setAutoCommit(true) on connection. If yes, where exactly should I call. Should I extend TransactionProxyFactoryBean or JtaTransactionManager class and override doBegin() method and there change the auto commit behaviour.
I'm posting my Spring bean configuration and datasource bean.
Is there any class which is creating problem with Sybase may be Driver class (com.sybase.jdbc2.jdbc.SybDriver) jconn2.jar or jotm or enhydra XADataSource. I'm only getting this error on Sybase and not on Oracle database.