How to set updatable column in a rowset.
I am using oracle 9i. I have a dataprovider which is pointed to a rowset. This rowset is based on an updatable view on oracle. Problem is that I need several column for displaying information, and the others for storing the data. When I write the rowset, it said:
[sunm][Oracle JDBC Driver][Oracle]ORA-01776: cannot modify more than one base table through a join view
It is quite understandable. The question is how to set a column in a row set as updatable or read only? Any sample code?
Thanks.
Message was edited by:
discusfish
[568 byte] By [
discusfish] at [2007-11-26 9:48:53]

# 1
No body answer my question? Perhaps it is not clear enough. Let me use another example. Suppose I want to update a table using a data provider. The PK of this table is updated using a trigger in database server. So basically, I don't need to write anything, the database server will handle the job. But, I do need to display the PK in my form.
In other language, if using ODBC, there is a facility to set an option whether a particular column is updatable or just read only. I don't see this in JSC SQL editor.
In the javadoc of CachedRowSetXImpl, I can see that there are getUpdatableColumns() and setUpdatableColumns(). Problem is that I don't know how to use this. Logically, first, I have to use getUpdatableColumns() first to see the status of all columns. But the javadoc said it will return null, if we don't use setUpdatableColumns(). It is complicated.
Is there any way to solve my problem?
thanks.
# 2
> In the javadoc of CachedRowSetXImpl, I can see that
> there are getUpdatableColumns() and
> setUpdatableColumns(). Problem is that I don't know
> how to use this. Logically, first, I have to use
> getUpdatableColumns() first to see the status of all
> columns. But the javadoc said it will return null, if
> we don't use setUpdatableColumns(). It is
> complicated.
>
From javadoc for CachedRowSetX,
for setUpdateableColumns(), I see this:
Parameters:
updatableColumns - an array of boolean, one for each column, which contains a boolean indicating whether or not the column should be updated when updating rows to the CachedRowSetX
So if your select is "SELECT pk, col1, col2 from BUGS_IN_CREATOR" then you'd call this method on your CachedRowSetX instance:
setUpdatableColumns( new boolean[] { false, true, true } ) ;
Disclaimer: I do not know if this actually works nor do I know if it's been tested.
# 3
Great. It works. Thanks.I hope they incorporate this (updatable/read only) in their SQL Editor. By using this code, we have to be careful not to alter the rowset. It is hard to debug, if somebody change the rowset definition, and then we forget to change the setUpdatableColumns().