Oracle Data Provider Insert Time (Need Help)

L

Larry

Below is code using the Oracle Data Adaptor and VB.NET.
All I am trying to do is make 100 insertions into the database.
From the time of the first "Console.WriteLine" until the last one
is 15 seconds. That is way too long for 100 insertions.

Can anyone see what I am doing wrong and what a fix might be?

=================================================================

Imports System
Imports Oracle.DataAccess.Client

Sub Main()

Dim constr As String = "User Id=user;Password=password;Data Source=data"
Dim con As New OracleConnection(constr)
Dim SQL As String
Dim cmd As New OracleCommand
Dim X As Integer

con.Open()
cmd.Connection = con
cmd.CommandType = CommandType.Text

For X = 1 To 100
SQL = "insert into test values ('1','2')"
cmd.CommandText = SQL
Console.WriteLine(SQL)
cmd.ExecuteReader()
Next

cmd.CommandText = "commit"
cmd.ExecuteReader()

cmd.Dispose()
con.Close()
con.Dispose()

End Sub
 
L

Larry

OK, I changed it to "ExecuteNonQuery".
Still took 15 seconds.

Follow up:
I ran the below task written in PL/SQL and ran it from
both SQL Plus and TOAD from my local machine to a remote
Oracle Database and I couldn't even blink my eye and it was done.

So I increased the inserts to 100,000 and it too was done very quickly.
But, my ODP.NET is painfully slow and I can't understand why.

Can anyone help me on this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top