Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

resultset autocommit off  RSS feed

Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a login servlet(for the online shopping cart) which does couple of functions:
1. checks for the validity of user.
2. checks if the new books have been added to database since the last login of the user. for this i update my database while resultset is open.
Statement stmt1 = connect.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
i have to make the resultset updateable and insensitive to scroll.
3. i also check the interest of the user(i get the user's interest while he registers and set the flag in the database accordingly) i get books from the database which are relevant to the user's interest. i get the resultset and pass it to the jsp to display the books. for this i need to have my autocommit off.(I dont know why ??)

while to update my database as required by the Req. -2, i need to have autocommit on.
I can create a separate Statement object for autocommit on and separate statement object for autocommit off. but that makes my servelet too slow to work properly.
I dont know how to incorporate both these requirements in the same servlet. please do suggest..
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!