You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Shah, Chintan V (Chintan)" <cv...@lucent.com> on 2001/10/23 14:32:06 UTC

resultSet.updateInt works awckwardly

Hi all,

Once again an off-topic... sorry for that...

In my java beans, i'm firing a Select query to get a row of data.

"Select * From <table> Where <fld1> = '12345'"

Now, this gives single row..., and i'm trying to update the contents of this
row as mentioned below.

if(rst.next)
{
	rst.updateString("<strFld>","<strVal>");
	rst.updateInt("<intFld>","<intVal>");
	rst.updateRow();
}

Where <strFld> is a field of data type *varchar*.
and <intFld> is a field of data type *int*.

But, after executing the code mentioned above, if i open the table and see
the data in *int field*, it is very awckward and not what i updated...

e.g. if the value in that row will be..."-3" or "6809034" or "242335" or
something like that, even though the <intVal> is 1 or 5 or 8 or something
like that... 

The above code works very well and updates the table field value properly
when database is Ms-Access..

What can be the problem ?? is it with SQL Server / Table field data type in
SQL Server / in my code above ???

please help me....

thanks and regards,
Chintan Shah

Re: resultSet.updateInt works awckwardly

Posted by Richard Troy <rt...@ScienceTools.com>.

Chintan,

Your post is both off-topic and resolved by RTFM. Also, you've made the
crutial mistake of confusing MS Access for a proper database engine. It is
FAR from it. What works in MS Access ... well, let me not digress. Let me
just echo what you've already seen on this list in just the last two days
- with a new analogy: MS Access is to the database world what the Tonka
truck is to the trucks that serve the mining industry - they kinda look
alike but one of them is obviously a toy.

Also, updating a selected item uses what we call cursors and are a VERY
poor choice of technique because cursors create locking and concurrency
issues. You should instead create a proper insert statement. Anyway,
should you wish to push ahead, read up on 'moveToCurrentRow()',
'moveToInsertRow()'.

Good luck with it,
RT

-- 
Richard Troy, Chief Scientist
Science Tools Corporation
rtroy@ScienceTools.com, 510-567-9957, http://ScienceTools.com/





-- 
Richard Troy, Chief Scientist
Science Tools Corporation
rtroy@ScienceTools.com, 510-567-9957, http://ScienceTools.com/

On Tue, 23 Oct 2001, Shah, Chintan V (Chintan) wrote:

> Date: Tue, 23 Oct 2001 18:02:06 +0530
> From: "Shah, Chintan V (Chintan)" <cv...@lucent.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: "'tomcat-user@jakarta.apache.org'" <to...@jakarta.apache.org>
> Subject: resultSet.updateInt works awckwardly
>
> Hi all,
>
> Once again an off-topic... sorry for that...
>
> In my java beans, i'm firing a Select query to get a row of data.
>
> "Select * From <table> Where <fld1> = '12345'"
>
> Now, this gives single row..., and i'm trying to update the contents of this
> row as mentioned below.
>
> if(rst.next)
> {
> 	rst.updateString("<strFld>","<strVal>");
> 	rst.updateInt("<intFld>","<intVal>");
> 	rst.updateRow();
> }
>
> Where <strFld> is a field of data type *varchar*.
> and <intFld> is a field of data type *int*.
>
> But, after executing the code mentioned above, if i open the table and see
> the data in *int field*, it is very awckward and not what i updated...
>
> e.g. if the value in that row will be..."-3" or "6809034" or "242335" or
> something like that, even though the <intVal> is 1 or 5 or 8 or something
> like that...
>
> The above code works very well and updates the table field value properly
> when database is Ms-Access..
>
> What can be the problem ?? is it with SQL Server / Table field data type in
> SQL Server / in my code above ???
>
> please help me....
>
> thanks and regards,
> Chintan Shah
>