Turn off transactions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Turn off transactions

Piotr Kosmowski
Hello,
Im using Mybatis with Mybatis-Guice for Sybase RDBS.
When I'm executing queries an exception occurs:
"com.sybase.jdbc3.jdbc.SybSQLException: Stored procedure
'rpcInGetMaterialMapping' may be run only in unchained transaction
mode. The 'SET CHAINED OFF' command will cause the current session to
use unchained transaction mode."

The error is connected with transactions and to be more precisely
stored procedure can not be executed in transaction batch. In the
environment where I cant use transactions (Connection gained from
driver manager not from data source) everything is fine.

So my question would be:
Is it possible to omit somehow transaction in myBatis. Maby this coud
help: <transactionManager type="EXTERNAL"> but I'm using Mybatis-Guice.
Reply | Threaded
Open this post in threaded view
|

Re: Turn off transactions

Eduardo Macarron
Nor Guice or MyBatis start a transaction, that is done automatically
by the database when a statement is called and autocommit is off.

I suppose the problem you have is that your procedure call must be
executed within its own transaction, that is, no more inserts, updates
from getConnection() to connection.commit(). Could you try to isolate
that piece of code in its own method so no other method is called?

On Jun 28, 12:27 pm, Piotr Kosmowski <[hidden email]> wrote:

> Hello,
> Im using Mybatis with Mybatis-Guice for Sybase RDBS.
> When I'm executing queries an exception occurs:
> "com.sybase.jdbc3.jdbc.SybSQLException: Stored procedure
> 'rpcInGetMaterialMapping' may be run only in unchained transaction
> mode. The 'SET CHAINED OFF' command will cause the current session to
> use unchained transaction mode."
>
> The error is connected with transactions and to be more precisely
> stored procedure can not be executed in transaction batch. In the
> environment where I cant use transactions (Connection gained from
> driver manager not from data source) everything is fine.
>
> So my question would be:
> Is it possible to omit somehow transaction in myBatis. Maby this coud
> help: <transactionManager type="EXTERNAL"> but I'm using Mybatis-Guice.
Reply | Threaded
Open this post in threaded view
|

Re: Turn off transactions

Clinton Begin
Administrator
Using autocommit is the right solution for sybase.



On 2011-06-28, Eduardo <[hidden email]> wrote:

> Nor Guice or MyBatis start a transaction, that is done automatically
> by the database when a statement is called and autocommit is off.
>
> I suppose the problem you have is that your procedure call must be
> executed within its own transaction, that is, no more inserts, updates
> from getConnection() to connection.commit(). Could you try to isolate
> that piece of code in its own method so no other method is called?
>
> On Jun 28, 12:27 pm, Piotr Kosmowski <[hidden email]> wrote:
>> Hello,
>> Im using Mybatis with Mybatis-Guice for Sybase RDBS.
>> When I'm executing queries an exception occurs:
>> "com.sybase.jdbc3.jdbc.SybSQLException: Stored procedure
>> 'rpcInGetMaterialMapping' may be run only in unchained transaction
>> mode. The 'SET CHAINED OFF' command will cause the current session to
>> use unchained transaction mode."
>>
>> The error is connected with transactions and to be more precisely
>> stored procedure can not be executed in transaction batch. In the
>> environment where I cant use transactions (Connection gained from
>> driver manager not from data source) everything is fine.
>>
>> So my question would be:
>> Is it possible to omit somehow transaction in myBatis. Maby this coud
>> help: <transactionManager type="EXTERNAL"> but I'm using Mybatis-Guice.

--
Sent from my mobile device