Wednesday, 15 September 2010

oracle11g - Cannot update Oracle view from JDBC -



oracle11g - Cannot update Oracle view from JDBC -

overview: need read row oracle view , create notes document, save document, write document unique id oracle.

i able read connect , read info no problem. using type 4 connection connecting oracle 11 database. oracle view setup allow updating. view has nil in outline here: in oracle, possible insert or update record through view?

*with same username , password, able update view typing in sql statement.

*tried using conn.setautocommit(false); had no effect.

*verified result set updatable (1008)

*user has been given total dba access (temporarily)

*i have tried every possible combination of first parameter in createstatement method

... statement statement = conn.createstatement(resultset.type_forward_only, resultset.concur_updatable); resultset rs = statement.executequery(fetch); ... string unid = doc.getuniversalid(); //gets unique id saved notes document system.out.println("this write oracle:" + unid); system.out.println("is updatable=1008, not updatable=1007 value is:" + rs.getconcurrency()); system.out.println("is result set closed:" + rs.isclosed()); rs.updatestring("notes_doc_id", unid); system.out.println("got past updating notes_doc_id column"); rs.updaterow(); //fails here

here error console:

this write oracle:bf8091259610c61b87257b16005c14fb

is updatable=1008, not updatable=1007 value is:1008

is result set closed:false

got past updating notes_doc_id column

java.security.accesscontrolexception: access denied (java.lang.runtimepermission exitvm.0)

prior asking user have dba access

java.sql.sqlsyntaxerrorexception: ora-01031: insufficient privileges

i think big clue. dba doesn't know farther access give me.

the dba wanting me start using ref cursors, fine, suspect there kind of security setting jdbc access tripping me up, , want explore first. if there security issue, don't think changing way read rows going create difference. of documentation on how obtained oracle's website, site.

i going reply question , explain how got past roadblock. in end, did 'a_horse_with_no_name' suggested.

instead of using resultset cursor or ref cursor perform update, able utilize plain update statement. possible, because able convince dba create column unique identifier. never around exceptions caused updaterow() method of resultset. prior him adding unique identifier, there not key in reliably utilize update statement.

here code updatesql string holding update sql statement:

updateresultint = updatestatement.executeupdate(updatesql);

it returns 1 if successful.

one word of caution, if using tools tora or sql plus check update statements, have remember manually commit them. if don't java agent hang when trying run it. here reference helped me issue: sql update hangs java program

thanks commented!

jdbc oracle11g lotus-domino

No comments:

Post a Comment