The Artima Developer Community
Sponsored Link

Java Answers Forum
JDBC Exception: Row update failed

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jay Kandy

Posts: 77
Nickname: jay
Registered: Mar, 2002

JDBC Exception: Row update failed Posted: Nov 22, 2002 2:57 PM
Reply to this message Reply
Advertisement
Hello All,

I am trying to update a row from a ResultSet but some thing seems to be out of place some where. Heres my skeleton method...
public void updateBug(int id, String actionDescription) throws SQLException
{
	Statement cs = connection.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
 
	cs.executeQuery("A Select statement");
 
	while (true)
	{
		int updateCount = cs.getUpdateCount();
		ResultSet rs = cs.getResultSet();
		if (rs == null && updateCount == -1) break;
 
		if (rs != null)
		{
			while (rs.next())
			{
				if(rs.getInt(BUG_ID) == id)
				{
					rs.updateString(ACTION_DESCRIPTION, "Hello World");
					rs.updateRow();
				}
			}
			rs.close();
		}
		cs.getMoreResults();
	}
 
	destroy();
}


and I get this trace...

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Row update fai
led.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source
)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseImplUpdatableResultSet.executeStatement(U
nknown Source)
at com.microsoft.jdbc.base.BaseImplUpdatableResultSet.updateRow(Unknown
Source)
at com.microsoft.jdbc.base.BaseResultSet.updateRow(Unknown Source)
at BTViewBugAction.updateBug(BTViewBugAction.java:230)
at BTViewBugAction.main(BTViewBugAction.java:288)


Line 230 is rs.updateRow() the SQL Error Code is 0 and the SQL State is HY000. I am using SQL Server 2000 driver v2.2, JDK 1.3.1. Googling didnt help me much. I will be thankful for any help.

Sincerely,
Jay

Topic: servlet Previous Topic   Next Topic Topic: Arithmetic java operators

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use