You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "jacob Lloyd (Gmail)" <ja...@gmail.com> on 2005/06/18 18:19:56 UTC
derby error checking ???
Hello all,
I'm reviewing derby and hsqldb to decide which embedded database will
best fit the projects needs (using as an alternative to ms-access).
The question is, in derby when using the ij tool to run automated
scripts or in server-side procs or triggers, how do you check errors
statuses/SQLStates?
For example if an INSERT fails I don't want to continue the balance of
the script. I've looked in the all of the manuals and have 'googled'
this topic and have found nothing.
Sincerely,
Jacob
Re: derby error checking ???
Posted by Myrna van Lunteren <m....@gmail.com>.
On 6/18/05, jacob Lloyd (Gmail) <ja...@gmail.com> wrote:
>
> Hello all,
>
> I'm reviewing derby and hsqldb to decide which embedded database will
> best fit the projects needs (using as an alternative to ms-access).
>
> The question is, in derby when using the ij tool to run automated
> scripts or in server-side procs or triggers, how do you check errors
> statuses/SQLStates?
>
> For example if an INSERT fails I don't want to continue the balance of
> the script. I've looked in the all of the manuals and have 'googled'
> this topic and have found nothing.
>
> Sincerely,
> Jacob
>
>
Hi Jacob,
The typical way you'd approach a failure returned from a JDBC-call
(statement, preparedStatement, callableStatement, etc) is to catch the
SQLException. You can probably find plenty of examples in any JDBC book.
A statement that would fire a trigger would still fail with an SQLException.
If you're talking about ij, and plain SQL-scripts - well, how about setting
autocommit off at the top and back on at the end of the SQL you want to be
committed or rolled back as a whole? Just let the transaction logic take
care of things that way without need to manually? It would work for the
insert example you give.
Myrna