• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

WebRowSet is not working when AutoCommit is 'true'

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WebRowSet is updatable by default right ? i.e it is CONCUR_UPDATABLE.
But, the below code doesn't work.

WebRowSet is reading data from xml file and i'm able to print it to console, but, the data is not reflecting in the database.



The same code works when i turn of auto-commit and the data is reflecting in database.

 
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In line 23 you are executing a SQL statement but in line 25 you are reading from an XML file, so I would think the data you are seeing is from the XML file, not the SQL.  I'm not sure why you would ever want to do this.  What are you trying to do?
 
Saarya Mohapatra
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I’m setting my WebRowSet object to a “Select” command and emp1 table is empty.

So, at this moment my WebRowSet object is empty.

Next, i’m reading from an xml file (containing employee data which i wrote using wrs.writeXml() in another program) into this WebRowSet object. So, my WebRowSet now contains employee data which i’m able to print to console.

Since WebRowSet is updatable by default i’m expecting this data in emp1 table.

But, this ain’t happening in the first piece of code where auto commit is on by default.
When i turn off auto commit and accept changes explicitly then the data is reflecting in emp1 table.

I’m wondering why the first piece of code is not working since all rowsets are updatable by default
 
Knute Snortum
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I'm guessing but I think the JDBC is considering that after an "execute()" it should commit, if it's in auto-commit mode.
 
Danger, 10,000 volts, very electic .... tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic