You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Arpit Gadle <ar...@gmail.com> on 2019/09/23 07:33:19 UTC

Apache Ignite SQL Table Transaction Not Working

Hi All,

I want to test transaction with Apache Ignite SQL table. For this I created
a small program. What the program does is

1. Start a ignite server node from the code itself.
2. Create a JDBC url to local ignite server
3. Get a JDBC connection, create the table
4. Get a JDBC connection, set  auto commit to false, insert few records,
then close the connection without committing.
5. Create a new jdbc connection, execute select query.

Output: As auto commit is set to false, after closing the connection, the
select query should have returned is returning records.

Expected Output: The select query should have returned no records, as auto
commit is set to false, and connection is not committed.

Ignite Version 2.7.0

Attaching
1. the sample code
2. pom.xml


Any help is appreciated.

Thanks
Arpit

Re: Apache Ignite SQL Table Transaction Not Working

Posted by Igor Belyakov <ig...@gmail.com>.
Hi,

By default Ignite uses "ATOMIC" atomicity mode which doesn't support
transactions:
https://apacheignite.readme.io/docs/transactions#section-atomicity-mode

In case you want to use transactions in SQL you should set
"TRANSACTIONAL_SNAPSHOT" atomicity level, as described here:
https://apacheignite-sql.readme.io/docs/multiversion-concurrency-control#section-overview

But I should mention that SQL transactions are in beta and not recommended
for usage in production, instead of that you can use key-value transactions
executed via JavaAPI:
https://apacheignite.readme.io/docs/transactions#section-ignitetransactions

Regards,
Igor

On Mon, Sep 23, 2019 at 10:33 AM Arpit Gadle <ar...@gmail.com> wrote:

> Hi All,
>
> I want to test transaction with Apache Ignite SQL table. For this I
> created a small program. What the program does is
>
> 1. Start a ignite server node from the code itself.
> 2. Create a JDBC url to local ignite server
> 3. Get a JDBC connection, create the table
> 4. Get a JDBC connection, set  auto commit to false, insert few records,
> then close the connection without committing.
> 5. Create a new jdbc connection, execute select query.
>
> Output: As auto commit is set to false, after closing the connection, the
> select query should have returned is returning records.
>
> Expected Output: The select query should have returned no records, as auto
> commit is set to false, and connection is not committed.
>
> Ignite Version 2.7.0
>
> Attaching
> 1. the sample code
> 2. pom.xml
>
>
> Any help is appreciated.
>
> Thanks
> Arpit
>
>
>