Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AS400 DB2 SQL7008 : Table name not valid for operations when inserting a record via Spring Boot

We have schemas / libraries created directly by OS/400 commands in DB2. Hence journaling will not be enabled by default for any physical file (table) If we would create newly. We are using DB Migration tool like liquibase for all DB changes like table / view creation in spring boot. while trying to insert or update, I am getting error "java.sql.SQLException: [SQL7008] X in TABLE_NAME not valid for operation". This error is due to the journaling not done on the newly created table via liquibase. Now, I am trying to find the below possibilities If available

  1. Is there any possibility of creating table (SQL) under the DB2 library 9created in OS/400) so that the journaling is not required while inserting or updating ?
  2. Is there any possibility of creating a journal on a table via Java/Spring Boot?
  3. or any suggestions rather than journaling the table everytime in DB2 side ?

Please give your comments

like image 609
Marudhu Avatar asked Jan 23 '26 05:01

Marudhu


2 Answers

When commitment control (transaction isolation) is used, journaling of the tables is required.

You have two options:

  1. turn off commitment control
  2. Turn on journaling for the tables

For option 1, you can include
transaction isolation=none;
in the connection string, see this question for more detail

For option 2, if you use the SQL CREATE SCHEMA and CREATE TABLE commands, to create the library and files, then the tables will be automatically journaled.

You can also use the Start Journal Library (STRJRNLIB) command after creating a library via the Create Library (CRTLIB) command. Thereafter, when you create a table or physical file in the library it will be journaled automatically.

like image 68
Charles Avatar answered Jan 25 '26 17:01

Charles


I had this error and fixed it using iAccess client tool. You can add DB2 journal using IBM i Access client tool. Steps Open the schema , Right click on Tables , then click include on the right click menu.

enter image description here

MYTABLE (the table I want to add journal) will be appeared on the list, then right click on the table name then and go to journaling, now add the values for Journal and library

like image 29
Ravinath Avatar answered Jan 25 '26 18:01

Ravinath



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!