Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Oracle and Dotnet
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Holger Baer  
View profile  
 More options Jun 3 2005, 3:44 am
Newsgroups: comp.databases.oracle.server
From: Holger Baer <holger.b...@science-computing.de>
Date: Fri, 03 Jun 2005 09:44:15 +0200
Local: Fri, Jun 3 2005 3:44 am
Subject: Re: Oracle and Dotnet

Larry wrote:
> Jim Kennedy wrote:

> Is it possible there are some inefficiencies in the code.  Sure.
> Do I think they are so bad to drop the rate from the 10,000 per second I
> get with PL/SQL on SQLplus down to 40 per second with ODP.NET.

> I doubt it.

> I only open the connection once.
> I'm not committing after each insert, I wait til the loop is finished.

So you think. But .NET is autocommiting as every junk was that excreated by MS.
(And the reason behind this is that MS SQL Server is not very good in long
running transactions). Even JDBC suffers the same problem (because most
Java guys are not much better when it comes to databases).

So search the .Net documentation how to turn off autocommit, and you'll be
fine.

> I'm not using binding because I insert the same fixed SQL statement each
> time.

> Are there some inefficiencies...maybe...but geez, 40 inserts per second?

You suffer the same problem that many developers suffer. You start out with
a small benchmark, and instead of trying to learn something out of it (namely
how to use Oracle correctly in the first place) you're prepared to blame anybody
else. A database is not a bit bucket and code that runs on one RDBMS will not
necessarily run well on another. ANSI SQL is a formal description of the SQLanguage,
however, it's implementation varies from RDBMS to RDBMS.

To simulate what the .NET code actually does, you can run the following test:
  declare
   2    l_txt varchar2(20);
   3  begin
   4    for i in 1..10000 loop
   5      l_txt := lpad (to_char(i), 20, '*');
   6      execute immediate 'insert into demo values (''' || l_txt  ||''')';
   7      commit;
   8    end loop;
   9 end;
  10 /

The timing will not be the same, but it will get you in the right direction.

Now how to fix this?
Try this:

>    //create the command and assign the connection to it
>     OracleCommand cmd = new OracleCommand();
>     cmd.Connection = con;

>     //create the SQL, no variables, no bindings to worry about
>     string SQL = "insert into test values ('1')";
>     cmd.CommandText = SQL;

       OracleTransation TransX = con.BeginTransaction();
       cmd.Transaction = TransX;

>     //do my loop
>     for (int x = 1; x<1000; x++)
>     {
>       cmd.ExecuteNonQuery();
>     }

       TransX.Commit();

I'm not a .NET developer. But http://www.datadirect.com/developer/net/dot_net_optimizing/index.ssp
seem to know what they are talking about.

HTH
Holger


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.