batch inserts

View: New views
9 Messages — Rating Filter:   Alert me  

batch inserts

by Ben Monro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Does anyone know if there is a way to do batch inserts with iBatis for .NET?

--
Ben Monro
Software Developer

Re: batch inserts

by Gilles Bayon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In ADO.NET there is no simple way to do batch statement in a db provider independent manner as in JBDC.

For now, I haven't think of a good solution  to implement batch support in iBATIS.NET.
Perhaps other people have some ideas ?

If you use SQL Server you do that with a store procedure and an XML in parameter.

--
Cheers,
Gilles

Re: batch inserts

by Ben Monro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well a couple things come to mind.  One is to model the batch insert functionality after the way it works in iBatis for Java.    If that doesnt work because of the ADO.NET restrictions then perhaps we could instead pass a collection of domain objects as a parameter to an insert query?  Then ibatis would then iterate over the collectino and generate a single query?
 
The Stored procedure option sounds promising...

On Mon, Jun 30, 2008 at 12:43 PM, Gilles Bayon <ibatis.net@gmail.com> wrote:
In ADO.NET there is no simple way to do batch statement in a db provider independent manner as in JBDC.

For now, I haven't think of a good solution  to implement batch support in iBATIS.NET.
Perhaps other people have some ideas ?

If you use SQL Server you do that with a store procedure and an XML in parameter.

--
Cheers,
Gilles



--
Ben Monro
Software Developer

Parent Message unknown Re: batch inserts

by Ron Grabowski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Have you seen this?

https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/rhino-commons/Rhino.Commons/ToPublic/SqlCommandSet.cs

----- Original Message ----
From: Gilles Bayon <ibatis.net@...>
To: user-cs@...
Sent: Monday, June 30, 2008 3:43:57 PM
Subject: Re: batch inserts

In ADO.NET there is no simple way to do batch statement in a db provider independent manner as in JBDC.

For now, I haven't think of a good solution  to implement batch support in iBATIS.NET.
Perhaps other people have some ideas ?

If you use SQL Server you do that with a store procedure and an XML in parameter.

--
Cheers,
Gilles

Re: batch inserts

by Gilles Bayon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I know that but it's SQL Server only.

On Mon, Jun 30, 2008 at 11:15 PM, Ron Grabowski <rongrabowski@...> wrote:
Have you seen this?

https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/rhino-commons/Rhino.Commons/ToPublic/SqlCommandSet.cs


----- Original Message ----
From: Gilles Bayon <ibatis.net@gmail.com>
To: user-cs@...
Sent: Monday, June 30, 2008 3:43:57 PM
Subject: Re: batch inserts

In ADO.NET there is no simple way to do batch statement in a db provider independent manner as in JBDC.

For now, I haven't think of a good solution  to implement batch support in iBATIS.NET.
Perhaps other people have some ideas ?

If you use SQL Server you do that with a store procedure and an XML in parameter.

--
Cheers,
Gilles


Re: batch inserts

by vinay.a :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

if you are using Microsoft SQL Server as your database and intend not to change it for a long time, then you can use "SqlBulkCopy Class". This class helps in batch uploading of data into a database table.

The SqlBulkCopy class can be used to write data only to SQL Server tables. However, the data source is not limited to SQL Server; any data source can be used, as long as the data can be loaded to a DataTable.

Refer the following links:

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx
http://www.codeproject.com/KB/database/SqlBulkCopy.aspx

If you come across a solution to this in iBatis.Net, please post a comment on it.



=========================================================
Ben Monro wrote:
Does anyone know if there is a way to do batch inserts with iBatis for .NET?

--
Ben Monro
Software Developer

Re: batch inserts

by vinay.a :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The link for 'SqlCommandSet.cs' has changed. See below:

http://rhino-tools.svn.sourceforge.net/viewvc/rhino-tools/trunk/commons/Rhino.Commons/ToPublic/SqlCommandSet.cs

Ron Grabowski wrote:
Have you seen this?

https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/rhino-commons/Rhino.Commons/ToPublic/SqlCommandSet.cs


----- Original Message ----
From: Gilles Bayon <ibatis.net@gmail.com>
To: user-cs@ibatis.apache.org
Sent: Monday, June 30, 2008 3:43:57 PM
Subject: Re: batch inserts

In ADO.NET there is no simple way to do batch statement in a db provider independent manner as in JBDC.

For now, I haven't think of a good solution  to implement batch support in iBATIS.NET.
Perhaps other people have some ideas ?

If you use SQL Server you do that with a store procedure and an XML in parameter.

--
Cheers,
Gilles

Re: batch inserts

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The exposed SqlCommandSet would definitely be a nice to have.  However, I do see a problem with the license and being able to just drop it in the source for iBatis as its currently licensed.  It could be wrapped as a third-party dll and reference that was as we currently do with the Castle dll's.  But that would bring the number of DLL's up to 5
DataMapper,Common,Castle.Core,Castle.DynamicProxy2,Rhino.Commons.Clr

thoughts?

On Thu, Nov 5, 2009 at 2:05 AM, vinay.a <vinay_onmail@...> wrote:

The link for 'SqlCommandSet.cs' has changed. See below:

http://rhino-tools.svn.sourceforge.net/viewvc/rhino-tools/trunk/commons/Rhino.Commons/ToPublic/SqlCommandSet.cs


Ron Grabowski wrote:
>
> Have you seen this?
>
> https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/rhino-commons/Rhino.Commons/ToPublic/SqlCommandSet.cs
>
>
> ----- Original Message ----
> From: Gilles Bayon <ibatis.net@gmail.com>
> To: user-cs@...
> Sent: Monday, June 30, 2008 3:43:57 PM
> Subject: Re: batch inserts
>
> In ADO.NET there is no simple way to do batch statement in a db provider
> independent manner as in JBDC.
>
> For now, I haven't think of a good solution  to implement batch support in
> iBATIS.NET.
> Perhaps other people have some ideas ?
>
> If you use SQL Server you do that with a store procedure and an XML in
> parameter.
>
> --
> Cheers,
> Gilles
>
>

--
View this message in context: http://old.nabble.com/batch-inserts-tp18124219p26208634.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@...
For additional commands, e-mail: user-cs-help@...




--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: batch inserts

by panji aryaputra :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all, can we use sql fragments as some sort of function? Is there a way to pass "parameters" to an sql fragment. My need is something like this (within one sql):
  
fragment1(parameter1)

union

fragment1(parameter2)

Or probably there is another way to achieve the same thing in ibatis? My intention is to simplify the application codes while at the same time I do not want to create functions in the DBMS. Hope I made my self clear.

TIA,
Panji

On Thu, Nov 5, 2009 at 9:23 PM, Michael McCurrey <mmccurrey@...> wrote:
The exposed SqlCommandSet would definitely be a nice to have.  However, I do see a problem with the license and being able to just drop it in the source for iBatis as its currently licensed.  It could be wrapped as a third-party dll and reference that was as we currently do with the Castle dll's.  But that would bring the number of DLL's up to 5
DataMapper,Common,Castle.Core,Castle.DynamicProxy2,Rhino.Commons.Clr

thoughts?


On Thu, Nov 5, 2009 at 2:05 AM, vinay.a <vinay_onmail@...> wrote:

The link for 'SqlCommandSet.cs' has changed. See below:

http://rhino-tools.svn.sourceforge.net/viewvc/rhino-tools/trunk/commons/Rhino.Commons/ToPublic/SqlCommandSet.cs


Ron Grabowski wrote:
>
> Have you seen this?
>
> https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/rhino-commons/Rhino.Commons/ToPublic/SqlCommandSet.cs
>
>
> ----- Original Message ----
> From: Gilles Bayon <ibatis.net@gmail.com>
> To: user-cs@...
> Sent: Monday, June 30, 2008 3:43:57 PM
> Subject: Re: batch inserts
>
> In ADO.NET there is no simple way to do batch statement in a db provider
> independent manner as in JBDC.
>
> For now, I haven't think of a good solution  to implement batch support in
> iBATIS.NET.
> Perhaps other people have some ideas ?
>
> If you use SQL Server you do that with a store procedure and an XML in
> parameter.
>
> --
> Cheers,
> Gilles
>
>

--
View this message in context: http://old.nabble.com/batch-inserts-tp18124219p26208634.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@...
For additional commands, e-mail: user-cs-help@...




--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/