You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Mamta Satoor <ma...@Remulak.Net> on 2005/01/14 22:11:20 UTC

Question on Read-only resultset and updateXXX and updateRow methods

Hi,

Unless I have missed it in the JDBC spec or apis, I don't think JDBC documentation
says when a driver should throw an exception for update attempt on a read-only
ResultSet.

In following eg, should the driver throw exception that update api not permitted on read-only
resultsets at rs.updateInt time or at rs.updateRow time?
   stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
   rs = stmt.executeQuery("SELECT c1,c2 FROM t1");
   rs.updateInt(1,222);
   rs.updateRow();

It seems like the right thing to do would be to throw an exception on updateInt method,
but I would like to know community's thoughts on this.

thanks,
Mamta


Re: Question on Read-only resultset and updateXXX and updateRow methods

Posted by "Lance J. Andersen" <La...@Sun.COM>.
Hi Mamta,

We have not totally closed on this yet.  However all but one vendor 
throws a SQLException on updateXXX in addition to updateRow().

-Lance

Mamta Satoor wrote:

>Hi Lance,
>
>I wondered if you got a chance to bring this issue up with the JDBC 4 EG.
>
>thanks,
>Mamta
>
>"Lance J. Andersen" wrote:
>
>  
>
>>I will discuss this with the JDBC 4 EG.
>>
>>As you point out this is not clear in the javadocs or the current  JDBC
>>3 spec.
>>
>>We are in the process of trying to clean up some areas in the spec.
>>This is another reasonable candidate.
>>
>>Regards
>>Lance
>>
>>Satheesh Bandaram wrote:
>>
>>    
>>
>>>I think throwing error in the updateInt() method early is good. Why wait
>>>till updateRow()?
>>>
>>>Also the JCC driver (Derby's current client JDBC driver) throws error
>>>for the updateInt(), so both embedded driver and the network driver
>>>would behave the same.
>>>
>>>Satheesh
>>>
>>>Mamta Satoor wrote:
>>>
>>>
>>>
>>>      
>>>
>>>>Hi,
>>>>
>>>>Unless I have missed it in the JDBC spec or apis, I don't think JDBC documentation
>>>>says when a driver should throw an exception for update attempt on a read-only
>>>>ResultSet.
>>>>
>>>>In following eg, should the driver throw exception that update api not permitted on read-only
>>>>resultsets at rs.updateInt time or at rs.updateRow time?
>>>> stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
>>>> rs = stmt.executeQuery("SELECT c1,c2 FROM t1");
>>>> rs.updateInt(1,222);
>>>> rs.updateRow();
>>>>
>>>>It seems like the right thing to do would be to throw an exception on updateInt method,
>>>>but I would like to know community's thoughts on this.
>>>>
>>>>thanks,
>>>>Mamta
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>        
>>>>
>
>  
>

Re: Question on Read-only resultset and updateXXX and updateRow methods

Posted by Mamta Satoor <ma...@Remulak.Net>.
Hi Lance,

I wondered if you got a chance to bring this issue up with the JDBC 4 EG.

thanks,
Mamta

"Lance J. Andersen" wrote:

> I will discuss this with the JDBC 4 EG.
>
> As you point out this is not clear in the javadocs or the current  JDBC
> 3 spec.
>
> We are in the process of trying to clean up some areas in the spec.
> This is another reasonable candidate.
>
> Regards
> Lance
>
> Satheesh Bandaram wrote:
>
> >I think throwing error in the updateInt() method early is good. Why wait
> >till updateRow()?
> >
> >Also the JCC driver (Derby's current client JDBC driver) throws error
> >for the updateInt(), so both embedded driver and the network driver
> >would behave the same.
> >
> >Satheesh
> >
> >Mamta Satoor wrote:
> >
> >
> >
> >>Hi,
> >>
> >>Unless I have missed it in the JDBC spec or apis, I don't think JDBC documentation
> >>says when a driver should throw an exception for update attempt on a read-only
> >>ResultSet.
> >>
> >>In following eg, should the driver throw exception that update api not permitted on read-only
> >>resultsets at rs.updateInt time or at rs.updateRow time?
> >>  stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
> >>  rs = stmt.executeQuery("SELECT c1,c2 FROM t1");
> >>  rs.updateInt(1,222);
> >>  rs.updateRow();
> >>
> >>It seems like the right thing to do would be to throw an exception on updateInt method,
> >>but I would like to know community's thoughts on this.
> >>
> >>thanks,
> >>Mamta
> >>
> >>
> >>
> >>
> >>
> >>


Re: Question on Read-only resultset and updateXXX and updateRow methods

Posted by "Lance J. Andersen" <La...@Sun.COM>.
I will discuss this with the JDBC 4 EG.

As you point out this is not clear in the javadocs or the current  JDBC 
3 spec.

We are in the process of trying to clean up some areas in the spec.  
This is another reasonable candidate.

Regards
Lance

Satheesh Bandaram wrote:

>I think throwing error in the updateInt() method early is good. Why wait
>till updateRow()?
>
>Also the JCC driver (Derby's current client JDBC driver) throws error
>for the updateInt(), so both embedded driver and the network driver
>would behave the same.
>
>Satheesh
>
>Mamta Satoor wrote:
>
>  
>
>>Hi,
>>
>>Unless I have missed it in the JDBC spec or apis, I don't think JDBC documentation
>>says when a driver should throw an exception for update attempt on a read-only
>>ResultSet.
>>
>>In following eg, should the driver throw exception that update api not permitted on read-only
>>resultsets at rs.updateInt time or at rs.updateRow time?
>>  stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
>>  rs = stmt.executeQuery("SELECT c1,c2 FROM t1");
>>  rs.updateInt(1,222);
>>  rs.updateRow();
>>
>>It seems like the right thing to do would be to throw an exception on updateInt method,
>>but I would like to know community's thoughts on this.
>>
>>thanks,
>>Mamta
>>
>>
>> 
>>
>>    
>>

Re: Question on Read-only resultset and updateXXX and updateRow methods

Posted by Satheesh Bandaram <sa...@Sourcery.Org>.
I think throwing error in the updateInt() method early is good. Why wait
till updateRow()?

Also the JCC driver (Derby's current client JDBC driver) throws error
for the updateInt(), so both embedded driver and the network driver
would behave the same.

Satheesh

Mamta Satoor wrote:

>Hi,
>
>Unless I have missed it in the JDBC spec or apis, I don't think JDBC documentation
>says when a driver should throw an exception for update attempt on a read-only
>ResultSet.
>
>In following eg, should the driver throw exception that update api not permitted on read-only
>resultsets at rs.updateInt time or at rs.updateRow time?
>   stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
>   rs = stmt.executeQuery("SELECT c1,c2 FROM t1");
>   rs.updateInt(1,222);
>   rs.updateRow();
>
>It seems like the right thing to do would be to throw an exception on updateInt method,
>but I would like to know community's thoughts on this.
>
>thanks,
>Mamta
>
>
>  
>