2

My situation: I work with a lot of RPG programmers who have created files on the IBM-i in a way that does not create a journal. I've created a Grails app which uses a db2 jdbc driver to connect to a file and update, insert, etc. I'm getting an error:

com.ibm.db2.jdbc.app.DB2DBException: MYFILE in MYLIB not valid for operation.
  Cause . . . . . :   The reason code is 3 .  Reason codes are:
  ...blah blah blah...
  3 -- MYFILE not journaled, no authority to the journal, or the journal state is *STANDBY.  Files with an RI constraint action of CASCADE, SET NULL, or SET DEFAULT must be journaled to the same journal. 
  ...blah blah blah...

I know that I could start journaling the file with STRJRNPF, but I'd rather not keep up with it (no scolding please). Is there a parameter for the db2 jdbc connection url that I can set to let it know not to try to commit?

Here's my current connection info:

dataSource
{
  dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
  pooled = true
  url = "jdbc:db2:*local;naming=system;libraries=LIBS;errors=full"
  driverClassName = "com.ibm.db2.jdbc.app.DB2Driver"
  username = "user"
  password = "pass"
  dialect = org.hibernate.dialect.DB2400Dialect.class
}

EDIT: Here is what I've tried:

url = "jdbc:db2:*local;naming=system;libraries=LIBS;errors=full;transaction isolation=none"
Weezle
  • 730
  • 10
  • 27
  • 2
    I think question [8232611](http://stackoverflow.com/questions/8232611/sql7008-error-workaround) answers this. – Buck Calabro Mar 08 '13 at 20:04
  • I tried this and got the same error. Could it be something to do with Grails using Hibernate perhaps? Is there a Hibernate property that I would need to change? – Weezle Mar 08 '13 at 20:28
  • I also tried setting auto commit=false. Same error. – Weezle Mar 08 '13 at 20:31
  • Don't know Hibernate or Grails. If you added `transaction isolation=none` to the connection string it should allow you to update to a non-journaled file. Alternately, try `UPDATE myfile set x=y WITH NC` – Buck Calabro Mar 08 '13 at 20:47

2 Answers2

1

Finally, this did end up having to do with Grails/Hibernate. Here is what the datasource ended up looking like:

dataSource
{
  dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
  pooled = true
  url = "jdbc:db2:*local;naming=system;libraries=LIBS;errors=full;transaction isolation=none"
  driverClassName = "com.ibm.db2.jdbc.app.DB2Driver"
  username = "user"
  password = "pass"
  dialect = org.hibernate.dialect.DB2400Dialect.class
  properties{                      
    defaultTransactionIsolation = 0
  }
}

Thanks to @Buck Calabro 's comments and this question.

Community
  • 1
  • 1
Weezle
  • 730
  • 10
  • 27
  • Please accept this answer. By doing that, people in the future who have this problem will be able to see what worked. – Buck Calabro Mar 09 '13 at 15:33
-1

What do you think "keep up with it" entails? By default, the system will do a lot of journal management for you. Welcome to IBM i. ;-)

WarrenT
  • 4,502
  • 19
  • 27
  • In no way was it intended as scolding. It was an honest question, trying to elicit what you thought the difficulty might be with managing journals, plus a good natured attempt to suggest that on this platform it may be much less work than you imagine. There was nothing negative intended, and I am sorry if my wording left room to be interpreted any other way, when I meant nothing more than to be friendly. – WarrenT Mar 10 '13 at 22:30
  • So to paraphrase... Didn't I say I wasn't scolding? ;-) – WarrenT Mar 23 '13 at 00:01