GeeCON Prague 2014*
The moose likes JDBC and the fly likes Disconnected Rowset in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Disconnected Rowset in Java" Watch "Disconnected Rowset in Java" New topic
Author

Disconnected Rowset in Java

Sadashiv Borkar
Ranch Hand

Joined: Jun 07, 2000
Posts: 49
Can anyone give me working example of using Disconnected rowset in Java .I had tried the example from sun site but it gives me acceptChanges Failed Exception when trying to update the Database..
Please HELP ITS URGENT !!!11
regards
Sada
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
You mean a CachedRowSet?
Try http://www.javaworld.com/javaworld/jw-02-2001/jw-0202-cachedrow.html
Let me know if it doesn't work.
Sadashiv Borkar
Ranch Hand

Joined: Jun 07, 2000
Posts: 49
hi,
Thanx for the URL the example worked fine The problem was that when i was updating i was updating a single column and as there where some columns in the table whose values should not be null.So the Cachedrowset was trying to update the other columns with null values ( I think this is incorrect way of updating for the cachedrowset it should onl update the single column without touching others or should update othersa with older values Isn't it correct to do that way )
Another thing is that the exception given by the Cachedrowset is not correct because it is difficult to understand the what went wrong.AS it almost took 2 hrs for me to solve this. As always it was giving me accept failed exception.
Now my question is
1) Is there anyway to understand what type of Exception is thrown by the Cached Rowset..??
2)My another question is
bit unrelated to above problem but related to RecordSet of java.I wanna update the table using updateRow() of the Resultset class.It doesnot work why..??
It gives me a exception saying the it doesnot support the command.
If the driver does not support scrolling and updation then how come it work with the CachedRowset.Iam using same drivers in both cases.
Please do help me.....

Iam sorry if its bit comfusing....
thanx again for the link
regards
Sada
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
Sorry. I am not sure I understand your question.
You can scroll with a CachedRowSet because it is disconnected from the database, hence it it just like any other regular Java bean.
What are you trying to do and what exception are you getting?
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

In a nutshell, it sounds like your driver does not support scrollable resultsets. Therefore, you can not perform resultset updates. But you already know this! It makes sense that the same is not possible for the CachedRowSet. The reason you can scroll through the CachedRowSet is that the fields are stored in memory, appearing to be scrollable. But since it inherits the java.sql.ResultSet methods when it comes to updating, you'll have the same problem as when you use the ResultSets(even if the error messages suck and are misleading!).
You can update your ODBC driver to one that implements the scrollable resultset, and that would probably solve your problem.(how and where to update your driver, I don't know, but I know you can!)
Jamie
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Disconnected Rowset in Java