Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

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: 7051
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: 7051
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.
 
We're all out of roofs. But we still have tiny ads:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic