I'm using the JTOpen JDBC driver for a DB2 Universal database. I have very little experience with SQL beyond simple statements.
From this question, I see that the error I'm getting (SQL7008) is thrown when trying to "insert/update rows in a non-journaled table during a transaction" (paraphrased).
According to the project lead, our DB is not journaled and won't be any time soon (don't ask me why, I'm not the DBA). However, I'm working on a project where being able to commit
everything in one go (rather than AutoCommit-ing each time an execute is called) is nearly necessary (not totally required, but it would solve a lot of issues down the road).
Is there any way to work around erorr SQL7008 without enabling Journalling?
There is an option that can be added to your connection string that disables commitment control.
Probably
CommitMode=0
would work.I have found that using
WITH NONE
at the end of the DB2 statement solve the problem, only if you use INSERT.When I try using
SET OPTION COMMIT=*NONE
on a Delete statement, it seems to skip the where, and it deletes everything, the same happens when i try to useWITH NC
orWITH NONE
More info...
The official listing of SQL7008 is here (do CTRL-F for SQL7008). It looks like you can get more information from the reason code. If you're getting reason code 3, it looks like there is no other option besides enabling journaling.
If you're getting something other than reason code 3, then I guess you have more options.
Hope that helps.
The only way to work around it without enabling journaling is to disable transaction isolation in your connection string as follows:
The full list of JDBC properties can be found in the IBM Toolbox for Java JDBC properties documentation.
If working on CL commands. The follow command solves the issue: