If I run this in H2 console:
SET AUTOCOMMIT FALSE;
PREPARE COMMIT PERS_DEL;
COMMIT TRANSACTION PERS_DEL;
the commands works, however:
Connection dataH2conn;
connectString = "jdbc:h2:" + urlH2loc + ";IFEXISTS=TRUE";
dataH2conn = DriverManager.getConnection(connectString, userId, passWord);
Statement stmt = dataH2conn.createStatement();
stmt.executeUpdate("PREPARE COMMIT PERS_DEL;");
fails with:
Syntax error in SQL statement "PREPARE TRANSACTION [*]PERS_DEL;"; expected
"(, AS"; SQL statement:
Nils
fredag 15. september 2023 kl. 09:11:07 UTC+2 skrev Nils Tolleshaug:
> When I do a series of delete operation in a H2 database as. ex remove a
> person recording in all related database tables, I think I can do the
> following:
>
> 1. SET AUTOCOMMIT FALSE
> 2. Beginning of delete person use PREPARE COMMIT deletePerson
> 3. If delete operation return normally without Exception, use COMMIT
> TRANSACTION deletePerson
> 4. If I experience an Exception, use ROLLBACK TRANSACTION deletePerson
> 5. In both cases the *close and reopen database ?*
>
> Will this work and is it really necessary to close and reopen database?
>
> Nils
>
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/h2-database/bbecc681-7102-4285-a0ec-28041380d651n%40googlegroups.com.