----- Original Message -----
From: "Matthew Baird" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Thursday, September 05, 2002 6:07 PM
Subject: RE: metrics on batch update


> do you think the addBatch() is the same as batch updates specific to
Oracle?

Unfortunately not. Oracle specific batching is "implicit". You don't have to
call addBatch() or sendBatch(). The driver automatically sends the batch
when the batch size is reached, whereas in JDBC 2.0 you have to make an
explicit call to both addBatch() and sendBatch().

With oracle batching, though, the driver knows ahead of time how big the
batch size will be so it can optimize the batch send. In this way oracle
batching tends to be more performant than vanilla JDBC 2.0 batching.

The oracle driver, of course, supports JDBC 2.0 batching, so maybe we could
have this be configurable: add a property in oracle.profile that toggles
between oracle-specific and standard batching. That way if the user is
deploying to a managed environment, they can just switch to standard
batching.

>
> -----Original Message-----
> From: Richard Beauchamp [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 05, 2002 6:01 PM
> To: OJB Users List
> Subject: Re: metrics on batch update
>
>
>
>
> > addBatch
> > public void addBatch()
> >               throws SQLExceptionAdds a set of parameters to this
> PreparedStatement object's batch of commands.
> > Throws:
> > SQLException - if a database access error occurs
> > Since:
> > 1.2
> > See Also:
> > Statement.addBatch(java.lang.String), What Is in the JDBC 2.0 API
> >
> > might try to use this on the platform defaultimpl instead of the oracle
> specific one.
>
> In the code I sent, the platform defaultimpl is a no-op. It just returns
the
> given PreparedStatement back to the caller without modification.
>
> But instead of a no-op, we could use the addBatch() function. Makes sense.
> This should work for JDBC 2.0 compliant drivers.
>
> Then the code would count how many calls to addBatch() have been made for
> the given PreparedStatement and call executeBatch() when:
>     1. (count == batchSize) or
>     2. It's time to commit the PB transaction and ((count % batchSize) !=
> 0).
>
> When executeBatch() is called the code would do the optimistic
locking/rows
> updated check.
>
> richard
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to