# DB Bulk Copy

### DBBulkCopy <a href="#dbbulkcopy" id="dbbulkcopy"></a>

*DBBulkCopy* allows you to efficiently copy a large number of rows to a table in a SQL Server or Oracle database.

This function creates a Loader object in its execution path. Use the SetValue function to add the rows that you want to insert. See the[ example](#example) below.

***

### Properties <a href="#properties" id="properties"></a>

#### Connection type <a href="#connection-type" id="connection-type"></a>

The type of database driver to use to connect to the database.

The supported driver types:

* SQL Server
* Oracle

#### Connection string <a href="#connection-string" id="connection-string"></a>

The [connection string](/reference/plugins/database/shared-properties/connectioneditor.md) that specifies how to connect to the database.

#### Timeout <a href="#timeout" id="timeout"></a>

The timeout value in seconds. 0 indicates the bulk copy operation will wait indefinitely.

#### Table <a href="#table" id="table"></a>

The name of the destination table.

Click on the ... icon to open the Editor.

***

**Destination Table Properties**

**Connection type**

The type of database driver to use to connect to the database.

The supported driver types:

* SQL Server
* Oracle

**Connection string**

The connection string that specifies how to connect to the database.

**Table**

Select the relevant table to copy to.

**Columns**

Indicate which columns to copy to.

#### Batch size <a href="#batch-size" id="batch-size"></a>

The number of rows to collect in a transaction before it is committed to the server.

***

### Example <a href="#example" id="example"></a>

Suppose you have a CSV text file with many records that need to be loaded into a database table. Using the *DbBulkCopy* function as shown below will run much quicker than doing it using the more generic ExecuteSQL function.

**Steps:**

1. From the Database plugin, drag the DBBulkCopy function onto the design canvas.
2. Set the DBBulkCopy properties (see above for details).
3. From the File plugin, drag the TextFileRead function onto the design canvas (nested below your DBBulkCopy function).
4. Set the *TextFileRead* properties to read all the rows from the source file that you want to copy across to your destination database.
5. From the Linx plugin, drag the *SetValue* function onto the design canvas (nested below the TextFileRead function).

   <div align="left"><figure><img src="/files/PqX6nbEeuS7aER01yVhz" alt=""><figcaption></figcaption></figure></div>
6. Set the *Target* property of the SetValue function to DbBulkCopy.Loader.Write.

<div align="left"><figure><img src="/files/Jeg1yJ18T2CR0Kfff0Ur" alt=""><figcaption></figcaption></figure></div>

7. Then click the Set Fields editor button next to the *Source* property to assign the values to the table's columns.

<div align="left"><figure><img src="/files/sHEOWvQyvoNUgZV2ps9g" alt="DB Bulk Copy Example"><figcaption></figcaption></figure></div>

***

#### BulkCopy from one DB to another

{% embed url="<https://youtu.be/EluxJCXN7pc>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.linx.software/reference/plugins/database/content/db-bulk-copy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
