Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle and Dotnet

Re: Oracle and Dotnet

From: Larry <larry_at_larry.com>
Date: Fri, 03 Jun 2005 01:21:34 GMT
Message-ID: <ygOne.10431$nG6.7249@attbi_s22>


Jim Kennedy wrote:

> So what is wrong with your example? Don't know, not enough information.
> Try the same thing by using slider. I bet you will be able to import a lot
> more than 35 records a second into that table via sqlloader. That would
> give you an idea of probably how fast odp.net would be if written
> effeciently. (estimate of top throughput in your environment.)

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. 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?

Here is the code again, it cannot be THAT inefficient!


using System;
using Oracle.DataAccess.Client;

class insert
{

   static void Main()
   {

     //connection string
     String cs = "User Id=nopusr;Password=nopusr;Data Source=nop";

     //create the connection and open
     OracleConnection con = new OracleConnection(cs);
     con.Open();

     //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;

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

     //done with the loop so I commit only once
     cmd.CommandText = "commit";
     cmd.ExecuteNonQuery();

     //clean up
     cmd.Dispose();
     con.Close();
     con.Dispose();

   }
} Received on Thu Jun 02 2005 - 20:21:34 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US