See Also

OracleLoader Members  | Devart.Data.Oracle Namespace  | OracleLoaderColumn Class  | OracleLoaderColumnCollection Class

Language

Visual Basic

C#

Show All

See AlsoLanguagesDevart.Data.OracleSend comments on this topic.

OracleLoader Class

Devart.Data.Oracle Namespace : OracleLoader Class

Serves to load external data into the Oracle database.

For a list of all members of this type, see OracleLoader members.

Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         Devart.Common.DbLoader
            Devart.Data.Oracle.OracleLoader

Syntax

[Visual Basic]
Public Class OracleLoader    Inherits DbLoader    Implements IComponentIDisposable 
[C#]
public class OracleLoader : DbLoader, IComponentIDisposable 

Remarks

In OCI mode OracleLoader uses direct path load interface to speed up loading. In Direct mode it uses array binding feature. To specify the name of table to load set TableName property. Use Columns property to access individual columns. See example below and Loader sample for detailed information.

The PRIMARY KEY, UNIQUE, and NOT NULL constaints are enabled when loading data with OracleLoader:

Restrictions of OracleLoader:

The following types are supported in when using direct path loading:

If an unsupported type is found, OracleLoader works via array binding.

This class is available only in Professional and Developer Editions. It is not available in Standard and Mobile Editions.

Example

The following example creates an OracleLoader, then populates Columns collection from table description, loads data, flushes the buffer and disposes internal OracleLoader structures. The OracleLoader requires open connection.

The following table is used in this example:

CREATE TABLE LOAD_TABLE(
  ID NUMBER,
  CHAR_FIELD VARCHAR(20),
  DATE_FIELD DATE,
  CONSTRAINT PK_LOAD_TABLE PRIMARY KEY (ID)
);

[C#] 

public void LoadData(OracleConnection conn) 

  // OracleLoader requires open connection 
  if (conn.State == ConnectionState.Closed) 
    conn.Open(); 
  OracleLoader loader = new OracleLoader(); 
  // Specify connection that OracleLoader will use for loading 
  loader.Connection = conn; 
  // Set table name that will be loaded into 
  loader.TableName = "load_table"; 
  // Populate Columns collection from table description 
  loader.CreateColumns(); 
  // Prepare OracleLoader for loading 
  loader.Open(); 
  for (int i = 0; i < 10000; i++) 
  { 
    loader.SetValue("id", i); 
    loader.SetValue("char_field", "test string"); 
    loader.SetValue("date_field", DateTime.Now); 
    loader.NextRow(); 
  } 
  // Flush buffer and dispose internal OracleLoader structures 
  loader.Close(); 

[Visual Basic] 

Public Sub LoadData(conn As OracleConnection)
  ' OracleLoader requires open connection
  If conn.State = ConnectionState.Closed
    conn.Open()
  End If
  Dim loader As OracleLoader
  loader = new OracleLoader
  ' Specify connection that OracleLoader will use for loading
  loader.Connection = conn
  ' Set table name that will be loaded into
  loader.TableName = "load_table"
  ' Populate Columns collection from table description
  loader.CreateColumns()
  ' Prepare OracleLoader for loading
  loader.Open()
  Dim i As Integer
  For i = 0 To 9999
    loader.SetValue("id", i)
    loader.SetValue("char_field", "test string")
    loader.SetValue("date_field", DateTime.Now)
    loader.NextRow()
  Next i
  ' Flush buffer and dispose internal OracleLoader structures
  loader.Close()
End Sub

See Also

OracleLoader Members  | Devart.Data.Oracle Namespace  | OracleLoaderColumn Class  | OracleLoaderColumnCollection Class

 

 


© 2002 - 2014 Devart. All Rights Reserved.