I use jdbc to connet to cockroachdb,
But I donot know how to chang isolation to si for my app。
the docs do not show that。
I saw that connetion string can chang it ,but I not found how to change it
By “si”, do you mean serializable isolation level?
If so, this is already the default for CockroachDB.
You can set the isolation level:
- per session using
SET TRANSACTION ISOLATION LEVEL <SERIALIZABLE | SNAPSHOT>;
- or per transaction using
BEGIN ISOLATION LEVEL <SERIALIZABLE | SNAPSHOT>;
.
Using JDBC, I think you can use Connection.setTransactionIsolation(TRANSACTION_SERIALIZABLE);
on a connection (but not a transaction).