hello,

looking at the do_jdbc I see following advantages in using jdbc
prepared statements:
* escaping of parameters is done by the jdbc driver, i.e. no DB
dependent code needed
* the jdbc implementation can use DB side prepared statements (if the
DB and jdbc driver supports it)
* prepared statement pooling is available on a per connection base (if
the driver supports it)
* prepared statement pooling is available on connection pools  if the
connection comes from datasource which implements such pooling

the last three points depends on the jdbc driver and/or database. in
case the database does not have DB side prepared statements than the
driver process the sql string and the bind_values similar as DO is
doing right now.

a downside would be that there are jdbc driver/database combination
where there is slight overhead using the jdbc prepared statements.

for the last point above do_jdbc needs to be able to use a datasource
for retrieving connections, i.e. use JNDI to retrieve the datasource.
since typical j2ee datasources are pooled datasources, the DO pooling
must be disabled/avoided.

any objections against using jdbc prepared statements in do_jdbc ??

Kristian

On Dec 2, 12:14 am, Dirkjan Bussink <[EMAIL PROTECTED]> wrote:
> On 1 Dec 2008, at 18:22, Bernerd Schaefer wrote:
>
> > Now, that's necessary for some databases, but, of course, many support
> > the preparing and binding DB side -- which is obviously much better.
>
> It's not always better, although we probably should use the driver's  
> parameter binding if we can. This could be done for example for MySQL  
> and PostgreSQL, which support binding parameters in the driver. This  
> can also improve the execution planning for the query, although that  
> really starts to matter with RDBMS's like Oracle.
>
> Always using prepared statements does incur an overhead, so that  
> should be done with care only.
>
> > DO also does not currently have any form of add/executeBatch, which,
> > in conjunction with true prepared statements, would be really useful.
>
> Well, you'd probably want a LRU cache or something similar to maintain  
> the prepared statements that are used, so you don't create to much but  
> also not too little, so you can benefit from reusing inserts / updates.
>
> --
> Regards,
>
> Dirkjan Bussink
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamapper@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to