ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Statement terminator
Date Tue, 11 Mar 2008 19:54:50 GMT
If I remember right, this stopped working with DB2 with the version DB2
version 8 JDBC drivers.  We had some similar issues and had to remove all
our semicolons (we weren't trying to do multiple statements - just had some
random semicolons at the end of statements).

I'll say also that I generally don't recommend trying to do two or
more statements with a single iBATIS call.  There's not much potential
benefit and, IMHO, it makes the code less readable and, therefore, harder to
maintain.  In effect, you're trying to write a stored proc on the client
side.  This is probably better done with a true stored proc, or a
Java method somewhere that executes multiple statements.

Jeff Butler

On Tue, Mar 11, 2008 at 2:35 PM, Michael Schall <mike.schall@gmail.com>
wrote:

> I'm attempting to perform two statements within a single insert.  We are
> using DB2 and I thought ; was the separator, but I get SQLSTATE: 42601.  I
> have tried several possible solutions with no luck.  Has anyone seen this or
> able to offer an idea?  Is this even possible?
>
> Thanks
> Mike
>
>     <insert id="insert" parameterClass="foo">
>         INSERT INTO ${schema}.foo(
>             id,
>             foo,
>             bar)
>         VALUES (
>             #id#,
>             #foo#,
>             #bar#);
>         UPDATE ${schema}.bar
>             SET bar = #bar#
>         WHERE
>             id = #id#
>             AND foo = #foo#
>     </insert>
>

Mime
View raw message