Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResultSet.TYPE_SCROLL_SENSITIVE is not reflecting the changes in the resultset

 
Vivek Raj
Ranch Hand
Posts: 33
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using jdbc thin driver to connect to Oracle DB. When I am using a ResultSet.TYPE_SCROLL_SENSITIVE, I am not able to see the changes in my resultset. Below is my code:



It is producing:
Before update
1 ODBC
After update
1 ODBC

Please let me know if I am missing anything.

Thank you.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Vivek!

I think you need to read the peculiarities of Oracle's JDBC driver implementation: http://docs.oracle.com/cd/B28359_01/java.111/b31224/resltset.htm#i1024192

I believe setting the resultset's fetch size to 1 might help. Or it might not, as moving to before the first row might not trigger reloading the rows from the database.

My advice would be not to use scroll-sensitive resultsets at all, but to devise another solution. If you state your requirements clearly, someone might suggest an alternative.

Oh, and I've added code tags to your post, it makes it look much better. You can do so yourself next time by using the Code button.

Edit: a missing commit might also be the cause of this problem, but as your code doesn't show you're turning autocommit off, I just suppose your connections are in autocommit mode.
 
Vivek Raj
Ranch Hand
Posts: 33
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Martin for your prompt reply.

I am new to JDBC, was trying different types of ResultSets, when I discovered that TYPE_SCROLL_SENSITIVE resultset is not behaving as expected.

I have set fetchsize to 1 still its not working. I believe it is because of driver implementation.

Vivek
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic