Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT FOR UPDATE query:

Status
Not open for further replies.

MrRaleigh

Programmer
Aug 5, 2005
1
0
0
GB
Hi,

I'm trying to query an AS/400 using a Java servlet containing the code below. Unfortunately I keep getting the error "FOR UPDATE CLAUSE NOT VALID" - I can't see where I'm going wrong though. . . Can anyone help?

Code:
Connection connection = null;
	Statement stmt = null;
	ResultSet rs = null;
	try 
       	{
		connection = MrcUtils.getDataSource().getConnection();
		stmt = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
			

					  rs = stmt.executeQuery("SELECT ZTUSER, ZTITNO, ZTROUT FROM MRCDEV.ZTROLINE INNER JOIN MVXCDTA300.MITATP ON ZTITNO=MAITNO AND ZTRWHS=MAWHLO WHERE ZTUSER='"+user+"' AND MAAVTP>0 AND ZTRWHS='110' AND MAPLDT=0 FOR UPDATE OF ZTROUT" ); // Get P and A items that are in stock for the current user

				while ( rs.next() ) 
				{

					rs.updateString("ZTROUT", route);

					rs.updateRow();

				}

			}

		catch( SQLException sqle ) 
		{
			throw new RuntimeException( "ProcessOrder.updateLines():" + sqle );
		}
		//finally { MrcUtils.cleanup( rs, connection ); } 
	}
 
I'd first check the authority on the file...maybe set *public to *all and see if that works.

Mark

There are 10 types of people in this world, those who understand binary and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top