ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sheshadri Patel <meeturpa...@gmail.com>
Subject Re: Bulk inserts
Date Thu, 03 Nov 2005 07:02:40 GMT
On 11/3/05, Steven Pannell <steven.pannell@zooplus.com> wrote:

> Hi,
>
> Is there a faster way of performing bulk inserts?
>
> currently I do something like:
>
>
> for(int i=1;i < list.size(); i++) {
>
> MyObject object = list.get(i);
> sqlMapClient.insert("myInsert", object);
>
> }
>
>
> This seems to take forever! Is is possible to pass the complete list or
> something to save on parsing the statement and getting releasing the
> connection for every insert statement??
>
> thx.
> Steve.

   Hi,
There's no way to insert List to a Dbase.But you can use executeBatch
provided by iBatis inorder to improve the performance and the network
traffic.

  sqlMapClient.startBatch();

for(int i=1;i < list.size(); i++) {

MyObject object = list.get(i);
sqlMapClient.insert("myInsert", object);

}
int no_rows_inserted = sqlMapClient.executeBatch();

Mime
View raw message