Java Update Sql statement error -


i trying update db2 database using java , following code:

string ssqlstring = "update p6devcdb00.p6ostapf set statval = '" + sstatval + "'  opiid = '" + soperationsitemid + "' , congrpc = '" + sconfiggrpcode  + "'";  // select on db table. //statement = con.createstatement(); statement = con.preparestatement(ssqlstring);  int rowsaffected = statement.executeupdate(); con.commit(); system.out.println(rowsaffected); 

i following error :

db2 sql error: sqlcode=-7008, sqlstate=55019, sqlerrmc=p6ostapf  ; p6devcdb00;3, driver=3.58.81 

i have printed out sql it's going run :

update  p6devcdb00.p6ostapf set statval = 'on'    opiid = 'b20120707000681531' , congrpc = 'stklststat 

when run sql directly sqlui tool works , record gets updated...

your problem you're attempting use transactions on tables not 'journaled' - is, setup transactions.

ideally, should set tables (that run under transaction) journaled, specifically test property; regardless of being able simulate failures, need make sure code can handle being under transactions.
also, depending on situation, may not need explicitly manage transactions. if you're using framework spring, can manage transactions for you, although mean still need journaling on iseries tables.

if you're trying test basic code behavior, using in-memory database, such hsqldb (can emulate luw db2 behavior, not library lists, unfortunately) - absolve of need have connection box, , set journaling.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -