Link to home
Start Free TrialLog in
Avatar of shji1
shji1

asked on

Microsoft JDBC driver issues

Hi,
I am building a system that uses JDBC to display query results in a table. Using JDBC, I enable row updates when a user edits a cell.
Here are the problems that I have with the latest Microsoft driver (SP3) on SQL Server 2000:

When updating a row (using the ResultSet updateRow) the row update is done successfully. However, there are 2 major problems with that:
(1) The ResultSet does not reflect the changes until I refresh the table by making the same query again. I've investigated it a bit, and it seems like the driver downgraded the Statement's TYPE_SCROLL_SENSITIVE to TYPE_SCROLL_INSENSITIVE for some reason, even though I am using the 'UseServerSideUpdatableCursors' parameter in the connection.
(2) If the user tries to edit the same cell again, before refreshing the result-set, he gets an exception indicating that the row could not be updated. Other cells can be updated. To conclude it... an update can be done only once per row value.

Are there any known solutions for these problems?

Thanks!
Avatar of girionis
girionis
Flag of Greece image

1) The updateRow does not update the ResultSet itself but the underlying database of which the datasource holds a reference to. You will need to make the same quesry again in order to get the new changes in the ResultSet.

2) check to see if the cursor is on the insert row, it will cause problems re-updating if it is. Otherwise you might not be able to do it twice before you get a new ResultSet again.

http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSet.html#updateRow()
Avatar of shji1
shji1

ASKER

I understand the architechture. The thing is that the same code works with MySQL and other servers (drivers), but doesn't work with MSSQL server.
ASKER CERTIFIED SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial