Hi,
OK I see the problem. The SQL statement "call" for H2 always returned a
result set (that's historical, simply changing it would break applications).
However, also since a long time, there is a hack in that if you call
Statement.executeUpdate and PreparedStatement.executeUpdate with a "call"
SQL statement, and if the "call" statement returns an int, then the int is
returned from the executeUpdate(). But it's hack really, as "call"
technically is a query. If you call Statement.executeUpdate("call 2+3"),
the result is 10. If you call Statement.executeQuery("call 2+3"), the
result is one row. The same with PreparedStatement.
For some reason, this hack doesn't work for CallableStatement however. I
think this was made for compatibility (I forgot).
So yes, right now, you can't use CallableStatement.executeUpdate() with the
SQL statement of type "call".
Regards,
Thomas
On Wed, Jul 31, 2013 at 11:01 PM, steve.ebersole
<[email protected]>wrote:
> I guess it is more that in H2 there is not way to define a procedure that
> acts as an 'executeUpdate' target. Sorry, I should have been more clear.
> In JDBC CallableStatement extends Statement. So CallableStatement also has
> executeUpdate
> and getUpdateCount methods that it inherits from Statement. I guess
> those are essentially non-functioning in H2 since there is (as far as I can
> tell) no way to define a procedure that "returns" affected row counts.
>
>
> On Wednesday, July 31, 2013 2:44:18 PM UTC-5, Thomas Mueller wrote:
>
>> Hi,
>>
>> Sorry I don't understand, the thread was about "call"
>> statements returning a result set or not, but you say Statement.executeUpdate
>> and Statement.getUpdateCount violating the JDBC API, which sounds like
>> something different.
>>
>> What is the problem in your case?
>>
>> Regards,
>> Thomas
>>
>>
>>
>> On Wed, Jul 31, 2013 at 9:06 PM, steve.ebersole <[email protected]>wrote:
>>
>>> Hi Thomas,
>>>
>>> It depends on the documentation you refer to. As the implementor of an
>>> API (JDBC) you also need to adhere to its documented behavior. I
>>> appreciate that H2 cannot do this now, but to say it is not a bug is a
>>> little disingenuous. The documentation for
>>> java.sql.Statement#**executeUpdate
>>> and java.sql.Statement#**getUpdateCount are quite clear, and H2
>>> currently violates them.
>>>
>>> Sorry to revive such an old thread, but this is hitting me in trying to
>>> test support for stored procedures in Hibernate. FWIW
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "H2 Database" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to h2-database...@**googlegroups.com.
>>>
>>> To post to this group, send email to [email protected].
>>> Visit this group at
>>> http://groups.google.com/**group/h2-database<http://groups.google.com/group/h2-database>
>>> .
>>> For more options, visit
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>>
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.