Hi Jenn,
What happens if you create a second statement, and use that to execute your updates?
I've noticed that result sets
seem tied to their sources - you might need to leave the rs-stmt pair alone, while
you do your update with a
separate statement. (example below - all I changed from your code was using
'statement2" rather than 'stmt' in the
executeUpdate() call.
Can anyone explain why a result set seems to remain tied to its source? Does this
happen in some cases but not
others? Is a result set actually a handle on a cursor within the database, rather than
a data structure of returned
results? It certainly seems to be. (I've been using JDK1.2, JSDK 2.0, and Oracle
drivers on an SGI with Irix 6.5.)
Joan
//Jenn's code, with suggested change
try {
rs=stmt.executeQuery("SELECT * FROM Temp where
CID='"+cid+"';");
while (rs.next()){
statement2.executeUpdate("INSERT INTO OrderItem
VALUES("+rs.getString(2)+","+oid+",'"+rs.getString(3)+"','"+rs.getString(4)+
"');");
}
}
catch (Exception e){error=""+e;}
>
> Hi all,
>
> I am having trouble trying to get the code below to work because it seems
> that the ResultSet rs gets corrupted whenever I run the statement to
> execute the SQL! The first insertion into the Temp table is executed, but
> after which the ResultSet becomes corrupted, the rs.next() becomes an
> invalid cursor state.
>
> try {
> rs=stmt.executeQuery("SELECT * FROM Temp where
>CID='"+cid+"';");
> while (rs.next()){
> stmt.executeUpdate("INSERT INTO OrderItem
> VALUES("+rs.getString(2)+","+oid+",'"+rs.getString(3)+"','"+rs.getString(4)+
> "');");
> }
> }
> catch (Exception e){error=""+e;}
>
>
> Please help on how to solve this problem
>
> Thanks in advance :)
> Jenn
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html