Search code examples
.netoracle.net-4.0oracle10goledb

Oracle simple INSERT statement taking ages


I have the below SQL which is getting executed with OleDBConnection and OleDBCommand and its taking forever and eventually times out and I dont know why. Before this script gets executed others are executed and they are fine. I don't know what's so special about this one.

begin
      insert into messages (message_id,message,store_in_log, message_group) 
         values (25000,'Production Floor','False','Locations');
      insert into messages (message_id,message,store_in_log, message_group) 
          values (25001,'Building 4 – A','False','Locations');
      insert into messages (message_id,message,store_in_log, message_group) 
          values (25002,'Building 3 – A','False','Locations');
      insert into messages (message_id,message,store_in_log, message_group) 
          values (25003,'Building 4 – B','False','Locations');
      insert into messages (message_id,message,store_in_log, message_group) 
          values (25004,'Building 4 – C','False','Locations');
      insert into messages (message_id,message,store_in_log, message_group) 
          values (25005,'Building 4 – D','False','Locations');
      insert into messages (message_id,message,store_in_log, message_group) 
          values (25006,'Quarantine','False','Locations');
      insert into messages (message_id,message,store_in_log, message_group) 
          values (25007,'Small Area','False','Locations');
end;

VB Code with OLEDB Connection:

        Dim sc As Script
        Dim C As New OleDb.OleDbConnection(CnStr)
        Dim Cmd As OleDb.OleDbCommand
        Dim sql As String
        For Each sc In s               
        sql = sc.OracleScript               

        Cmd = New OleDb.OleDbCommand(sql, C)
        Try
           Cmd.Connection.Open()
           Cmd.ExecuteNonQuery()
        Catch ex As Exception

        Finally
           Cmd.Connection.Close()
           Cmd.Dispose()
           Cmd = Nothing
        End Try

        Next

Solution

  • The insert statement is really simple. Have you check for locks?