• Post Reply Bookmark Topic Watch Topic
  • New Topic

CachedRowSet acceptchanges()  RSS feed

 
Objsooj Ram
Greenhorn
Posts: 9
Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to commit changes to mysql db using CachedRowSet.
Though the changes are updated to db, an error "java.sql.SQLException: Can't call commit when autocommit=true" is thrown.
I realise that autocommit is set to True by default, but i do not have a way to set it to False as I am using a Factory provider to create an instance.
So, how do i overcme the error thrown?



Thanks
 
Campbell Ritchie
Sheriff
Posts: 53622
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this discussion would fit better in our databases fora. Moving.
 
T Mishra
Ranch Hand
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a reference to the connection object ? if yes, you can set 'autoCommit = false; before passing it to CachedRowSet#acceptChanges(Connection) .

If not, you can find out the implementation class of CachedRowSet. The default implemtation from sun is CachedRowSetImpl. You can obtain the connection using CachedRowSetImpl.html#getConnection().
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!