Hello Kolja,

If you had taken a look at the javadoc of PreparedStatement.execute you might possibly
have noticed:

-- snip --
The execute method returns a boolean to indicate the form of the first result. You 
must call 
either the method getResultSet or getUpdateCount to retrieve the result; you must call 
getMoreResults to move to any subsequent result(s). 

Returns:
        true if the first result is a ResultSet object; false if the first result is 
an 
      update count or there is no result 
-- snap --

As you statement seems not to return a result set, it will return false. 

Keep in mind that these SQLExceptions are used for errors, so you will
get an exception with native error code 400 if the lock could not be 
acquired due to another session having the lock.

Regards

Alexander Schr�der
SAP DB, SAP Labs Berlin 

> -----Original Message-----
> From: Kolja Kleist [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 06, 2003 12:13 PM
> To: [EMAIL PROTECTED]
> Subject: JDBC: PreparedStatement.execute() returns false with
> LOCK-Statement
> 
> 
> Hello,
> 
> I tried to execute the LOCK-Statement with a PreparedStatement like:
> 
> PreparedStatement stmt = conn.prepareStatement(
>       "LOCK (NOWAIT) ROW tablename KEY id = ? IN EXCLUSIVE MODE");
> stmt.setBigDecimal(1, new BigDecimal("1000"));
> boolean success = stmt.execute();
> 
> The problem is, that stmt.execute() returns false. But the 
> lock will be set
> correctly.
> Is this a bug?
> I'm using the following JDBC driver:
> package com.sap.dbtech.jdbc, SAP DB JDBC Driver, SAP AG, 
> 7.4.4    Build
> 001-000-156-985
> 
> Regards,
> Kolja
> 
> Mit besten Gruessen
> Kolja Kleist (Senior Developer)
> ____________________________________
> MediaTransfer AG
> Netresearch & Consulting
> Rothenbaumchaussee 38, 20148 Hamburg
> Tel: (040) 669 625 16
> Fax: (040) 669 625 29
> URL: http://b2b.mediatransfer.de
> ____________________________________
> 
> _______________________________________________
> sapdb.general mailing list
> [EMAIL PROTECTED]
> http://listserv.sap.com/mailman/listinfo/sapdb.general
> 
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to