diff --git a/docs/integrations/builtin/app-nodes/n8n-nodes-base.oracledb/index.md b/docs/integrations/builtin/app-nodes/n8n-nodes-base.oracledb/index.md new file mode 100644 index 0000000000..a2ac34530d --- /dev/null +++ b/docs/integrations/builtin/app-nodes/n8n-nodes-base.oracledb/index.md @@ -0,0 +1,237 @@ +--- +title: Oracle Database node documentation +description: Learn how to use the Oracle Database node in n8n. Follow technical documentation to integrate Oracle Database node into your workflows. +contentType: [integration, reference] +priority: critical +--- + +# Oracle Database node + +Use the Oracle Database node to automate work in Oracle Database, and integrate Oracle Database with other applications. n8n has built-in support for a wide range of Oracle Database features which includes executing an SQL statement, fetching, inserting, updating or deleting data from Oracle Database. + +On this page, you'll find a list of operations the Oracle Database node supports and links to more resources. + +/// note | Credentials +Refer to [Oracle Database credentials](/integrations/builtin/credentials/oracledb.md) for guidance on setting up authentication. +/// + +--8<-- "/_snippets/integrations/builtin/app-nodes/ai-tools.md" + +## Operations + +* [**Delete**](#delete): Delete an entire table or rows in a table +* [**Execute SQL**](#execute-sql): Execute an SQL statement +* [**Insert**](#insert): Insert rows in a table +* [**Insert or Update**](#insert-or-update): Insert or update rows in a table +* [**Select**](#select): Select rows from a table +* [**Update**](#update): Update rows in a table + +### Delete + +Use this operation to delete an entire table or rows in a table. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Oracle Database credential](/integrations/builtin/credentials/oracledb.md). +- **Operation**: Select **Delete**. +- **Schema**: Choose the schema that contains the table you want to work on. Select **From list** to choose the schema from the dropdown list or **By Name** to enter the schema name. +- **Table**: Choose the table that you want to work on. Select **From list** to choose the table from the dropdown list, or select **By Name** to enter the table name. +- **Command**: The deletion action to take: + - **Truncate**: Removes the table's data but preserves the table's structure. + - **Delete**: Delete the rows that match the "Select Rows" condition. If you don't select anything, Oracle Database deletes all rows. + - **Select Rows**: Define a **Column**, **Operator**, and **Value** to match rows on. The value + can be passed as JSON using expression or string. + - **Combine Conditions**: How to combine the conditions in "Select Rows". The **AND** requires all conditions to be true, while **OR** requires at least one condition to be true. + - **Drop**: Deletes the table's data and structure permanently. + +#### Delete options + +- **Auto Commit**: When this property is set to true, the transaction in the current connection is automatically committed at the end of statement execution. +- **Statement Batching**: The way to send statements to the database: + - **Single Statement**: A single statement for all incoming items. + - **Independently**: Execute one statement per incoming item of the execution. + - **Transaction**: Execute all statements in a transaction. If a failure occurs, Oracle Database rolls back all changes. + +### Execute SQL + +Use this operation to execute an SQL statement. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Oracle Database credential](/integrations/builtin/credentials/oracledb.md). +- **Operation**: Execute SQL **Execute SQL**. +- **Statement**: The SQL statement to execute. You can use n8n [expressions](/code/expressions.md) and positional parameters like `:1`, `:2`, or named parameters like `:name`, `:id` to use with [Use bind parameters](#use-bind-parameters). + +#### Execute Statement options + +- **Auto Commit**: When this property is set to true, the transaction in the current connection is automatically committed at the end of statement execution. +- **Bind Variable Placeholder Values**: Enter the values for the bind parameters used in the statement [Use bind parameters](#use-bind-parameters). +- **Output Numbers As String**: Indicates if the numbers should be retrieved as a String. +- **Fetch Array Size**: This property is a number that sets the size of an internal buffer used for fetching query rows from Oracle Database. Changing it may affect query performance but does not affect how many rows are returned to the application. +- **Number of Rows to Prefetch**: This property is a query tuning option to set the number of additional rows the underlying Oracle driver fetches during the internal initial statement execution phase of a query. + +### Insert + +Use this operation to insert rows in a table. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Oracle Database credential](/integrations/builtin/credentials/oracledb.md). +- **Operation**: Select **Insert**. +- **Schema**: Choose the schema that contains the table you want to work on. Select **From list** to choose the schema from the dropdown list or **By Name** to enter the schema name. +- **Table**: Choose the table that you want to work on. Select **From list** to choose the table from the dropdown list, or select **By Name** to enter the table name. +- **Mapping Column Mode**: How to map column names to incoming data: + - **Map Each Column Manually**: Select the values to use for each column [Use n8n expressions for bind values](#use-n8n-expressions-for-bind-values). + - **Map Automatically**: Automatically map incoming data to matching column names in Oracle Database. The incoming data field names must match the column names in Oracle Database for this to work. If necessary, consider using the [edit fields (set) node](/integrations/builtin/core-nodes/n8n-nodes-base.set.md) before this node to adjust the format as needed. + +#### Insert options + +- **Auto Commit**: When this property is set to true, the transaction in the current connection is automatically committed at the end of statement execution. +- **Output Columns**: Choose which columns to output. You can select from a list of available columns or specify IDs using [expressions](/code/expressions.md). +- **Statement Batching**: The way to send statements to the database: + - **Single Statement**: A single statement for all incoming items. + - **Independently**: Execute one statement per incoming item of the execution. + - **Transaction**: Execute all statements in a transaction. If a failure occurs, Oracle Database rolls back all changes. + +### Insert or Update + +Use this operation to insert or update rows in a table. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Oracle Database credential](/integrations/builtin/credentials/oracledb.md). +- **Operation**: Select **Insert or Update**. +- **Schema**: Choose the schema that contains the table you want to work on. Select **From list** to choose the schema from the dropdown list or **By Name** to enter the schema name. +- **Table**: Choose the table that you want to work on. Select **From list** to choose the table from the dropdown list, or select **By Name** to enter the table name. +- **Mapping Column Mode**: How to map column names to incoming data: + - **Map Each Column Manually**: Select the values to use for each column [Use n8n expressions for bind values](#use-n8n-expressions-for-bind-values). + - **Map Automatically**: Automatically map incoming data to matching column names in Oracle Database. The incoming data field names must match the column names in Oracle Database for this to work. If necessary, consider using the [edit fields (set) node](/integrations/builtin/core-nodes/n8n-nodes-base.set.md) before this node to adjust the format as needed. + +#### Insert or Update options + +- **Auto Commit**: When this property is set to true, the transaction in the current connection is automatically committed at the end of statement execution. +- **Output Columns**: Choose which columns to output. You can select from a list of available columns or specify IDs using [expressions](/code/expressions.md). +- **Statement Batching**: The way to send statements to the database: + - **Single Statement**: A single statement for all incoming items. + - **Independently**: Execute one statement per incoming item of the execution. + - **Transaction**: Execute all statements in a transaction. If a failure occurs, Oracle Database rolls back all changes. + +### Select + +Use this operation to select rows in a table. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Oracle Database credential](/integrations/builtin/credentials/oracledb.md). +- **Operation**: Select **Select**. +- **Schema**: Choose the schema that contains the table you want to work on. Select **From list** to choose the schema from the dropdown list or **By Name** to enter the schema name. +- **Table**: Choose the table that you want to work on. Select **From list** to choose the table from the dropdown list, or select **By Name** to enter the table name. +- **Return All**: Whether to return all results or only up to a given limit. +- **Limit**: The maximum number of items to return when **Return All** is disabled. +- **Select Rows**: Set the conditions to select rows. Define a **Column**, **Operator**, and **Value**(as `json`) to match rows on. If you don't select anything, Oracle Database selects all rows. +- **Combine Conditions**: How to combine the conditions in **Select Rows**. The **AND** requires all conditions to be true, while **OR** requires at least one condition to be true. +- **Sort**: Choose how to sort the selected rows. Choose a **Column** from a list or by ID and a sort **Direction**. + +#### Select options + +- **Auto Commit**: When this property is set to true, the transaction in the current connection is automatically committed at the end of statement execution. +- **Output Numbers As String**: Indicates if the numbers should be retrieved as a String. +- **Fetch Array Size**: This property is a number that sets the size of an internal buffer used for fetching query rows from Oracle Database. Changing it may affect query performance but does not affect how many rows are returned to the application. +- **Number of Rows to Prefetch**: This property is a query tuning option to set the number of additional rows the underlying Oracle driver fetches during the internal initial statement execution phase of a query. + +### Update + +Use this operation to update rows in a table. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Oracle Database credential](/integrations/builtin/credentials/oracledb.md). +- **Operation**: Select **Update**. +- **Schema**: Choose the schema that contains the table you want to work on. Select **From list** to choose the schema from the dropdown list or **By Name** to enter the schema name. +- **Table**: Choose the table that you want to work on. Select **From list** to choose the table from the dropdown list, or select **By Name** to enter the table name. +- **Mapping Column Mode**: How to map column names to incoming data: + - **Map Each Column Manually**: Select the values to use for each column [Use n8n expressions for bind values](#use-n8n-expressions-for-bind-values). + - **Map Automatically**: Automatically map incoming data to matching column names in Oracle Database. The incoming data field names must match the column names in Oracle Database for this to work. If necessary, consider using the [edit fields (set) node](/integrations/builtin/core-nodes/n8n-nodes-base.set.md) before this node to adjust the format as needed. + +#### Update options + +- **Auto Commit**: When this property is set to true, the transaction in the current connection is automatically committed at the end of statement execution. +- **Output Columns**: Choose which columns to output. You can select from a list of available columns or specify IDs using [expressions](/code/expressions.md). +- **Statement Batching**: The way to send statements to the database: + - **Single Statement**: A single statement for all incoming items. + - **Independently**: Execute one statement per incoming item of the execution. + - **Transaction**: Execute all statements in a transaction. If a failure occurs, Oracle Database rolls back all changes. + +## Related resources + +Refer to [SQL Language Reference](https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=SQLRF) for more information about the service. + +Refer to [node-oracledb](https://node-oracledb.readthedocs.io/en/latest/) for more information about the oracledb client driver. + +## Use bind parameters + +When creating a statement to run on an Oracle database instance, you can use the **Bind Variable Placeholder Values** field in the **Options** section to load data into the statement. n8n sanitizes data in statement parameters, which prevents SQL injection. + +For example, you would want to find specific fruits by their color. Given the following input data: + +```js +[ + { + "FRUIT_ID": 1, + "FRUIT_NAME": "Apple", + "COLOR": "Red" + }, + { + "FRUIT_ID": 2, + "FRUIT_NAME": "Banana", + "COLOR": "Yellow" + } +] +``` + +You can write a statement like: + +```sql +SELECT * FROM FRUITS WHERE COLOR = :col +``` + +Then in **Bind Variable Placeholder Values**, provide the field values to use. You can provide fixed values or expressions. For this example, use expressions so the node can pull the color from each input item in turn: + +```js +// fruits is an example table name +fruits, {{ $json.color }} +``` + +## Use n8n Expressions for bind values + +For **Values to Send**, you can provide inputs using n8n Expressions. Below are examples for different data types — you can either enter constant values or reference fields from previous items (`$json`): + +### JSON +- Constant: `{{ { k1: "v1", k2: "v2" } }}` +- From a previous item: `{{ $json.COL_JSON }}` + +### VECTOR +- Constant: `{{ [1, 2, 3, 4.5] }}` +- From a previous item: `{{ $json.COL_VECTOR }}` + +### BLOB +- Constant: `{{ [94, 87, 34] }}` or `{{ ' BLOB data string' }}` +- From a previous item: `{{ $json.COL_BLOB }}` + +### RAW +- Constant: `{{ [94, 87, 34] }}` +- From a previous item: `{{ $json.COL_RAW }}` + +### BOOLEAN +- Constant: `{{ true }}` +- From a previous item: `{{ $json.COL_BOOLEAN }}` + +### NUMBER +- Constant: `1234` +- From a previous item: `{{ $json.COL_NUMBER }}` + +## VARCHAR +- Constant: `' Hello World '` +- From a previous item: `{{ $json.COL_CHAR }}` + +These examples assume JSON keys (e.g. `COL_JSON, COL_VECTOR`) map directly to the respective SQL column types. diff --git a/docs/integrations/builtin/credentials/oracledb.md b/docs/integrations/builtin/credentials/oracledb.md new file mode 100644 index 0000000000..6623156e99 --- /dev/null +++ b/docs/integrations/builtin/credentials/oracledb.md @@ -0,0 +1,74 @@ +--- +title: Oracle Database credentials +description: Documentation for Oracle Database credentials. Use these credentials to authenticate Oracle Database in n8n, a workflow automation platform. +contentType: [integration, reference] +priority: high +--- + +# Oracle Database credentials + +You can use these credentials to authenticate the following nodes: + +- [OracleDB](/integrations/builtin/app-nodes/n8n-nodes-base.oracledb/index.md) +- [Agent](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/index.md) + +/// note +These nodes do not support SSH tunnels. +They require Oracle Database 19c or later. For thick mode, use Oracle Client Libraries 19c or later. +/// + +## Prerequisites + +Create a user account on a [OracleDB](https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-F0246961-558F-480B-AC0F-14B50134621C) server database. + +## Supported authentication methods + +- Database connection + +## Related resources + +Refer to [Oracle Database documentation](https://docs.oracle.com/en/database/oracle/oracle-database) for more information about the service. + +## Using database connection + +To configure this credential, you'll need: + +- A **User** name. +- A **Password** for that user. +- **Connection String**: The Oracle database instance to connect to. The string can be an Easy Connect string, or a TNS Alias from a tnsnames.ora file, or the Oracle database instance. +- **Use Optional Oracle Client Libraries**: If you want to use node-oracledb Thick mode for working with Oracle Database advanced features, turn this on. This option is not available in official n8n docker images. Additional settings to enable Thick mode are required. Refer to [Enabling Thick mode documentation](https://node-oracledb.readthedocs.io/en/latest/user_guide/initialization.html#enabling-node-oracledb-thick-mode) for more information. +- **Use SSL**: If your Connection String is using SSL, turn this on and configure additional details for the SSL Authentication. +- **Wallet Password**: The password to decrypt the Privacy Enhanced Mail (PEM)-encoded private certificate, if it is encrypted. +- **Wallet Content**: The security credentials required to establish a mutual TLS (mTLS) connection to Oracle Database. +- **Distinguished Name**: The distinguished name (DN) that should be matched with the certificate DN. +- **Match Distinguished Name**: Whether the server certificate DN should be matched in addition to the regular certificate verification that is performed. +- **Allow Weak Distinguished Name Match**: Whether the secure DN matching behavior which checks both the listener and server certificates has to be performed. +- **Pool Min**: The number of connections established to the database when a pool is created. +- **Pool Max**: The maximum number of connections to which a connection pool can grow. +- **Pool Increment**: The number of connections that are opened whenever a connection request exceeds the number of currently open connections. +- **Pool Maximum Session Life Time**: The number of connections that are opened whenever a connection request exceeds the number of currently open connections. +- **Pool Connection Idle Timeout**: The number of connections that are opened whenever a connection request exceeds the number of currently open connections. +- **Connection Class Name**: DRCP/PRCP Connection Class. Refer to [Enabling DRCP](https://docs.oracle.com/en/database/oracle/oracle-database/26/admin/managing-processes.html#GUID-BB76E57C-3F16-4C85-AEF6-BA14FC1B4777) for more information. +- **Connection Timeout**: The timeout duration in seconds for an application to establish an Oracle Net connection. +- **Transport Connection Timeout**: The maximum number of seconds to wait to establish a connection to the database host. +- **Keepalive Probe Interval**: The number of minutes between the sending of keepalive probes. + + +To set up your database connection credential: + +1. Enter your database's username as the **User** in your n8n credential. + +2. Enter the user's **Password**. + +3. Enter your database's connection string as the **Connection String** in your n8n credential. + +4. If your database uses SSL and you'd like to configure **SSL** for the connection, turn this option on in the credential. If you turn it on, enter the information of your Oracle Database SSL certificate in these fields: + 1. Enter the output of PEM-encoded wallet file, **ewallet.pem** contents after retaining the new lines. The command + + ```bash + node -e "console.log('{{\"' + require('fs').readFileSync('ewallet.pem', 'utf8').split('\n').join('\\\\n') + '\"}}')" + ``` + + can be used to dump file contents in the **Wallet Content** field. + +Refer to [node-oracledb](https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#mutual-tls-connections-to-oracle-cloud-autonomous-database) for more information on working with TLS connections. diff --git a/nav.yml b/nav.yml index d8037fb1a6..83c59fc4ed 100644 --- a/nav.yml +++ b/nav.yml @@ -480,6 +480,8 @@ nav: - Common issues: integrations/builtin/app-nodes/n8n-nodes-langchain.openai/common-issues.md - OpenThesaurus: integrations/builtin/app-nodes/n8n-nodes-base.openthesaurus.md - OpenWeatherMap: integrations/builtin/app-nodes/n8n-nodes-base.openweathermap.md + - Oracle Database: + - Oracle Database: integrations/builtin/app-nodes/n8n-nodes-base.oracledb/index.md - Oura: integrations/builtin/app-nodes/n8n-nodes-base.oura.md - Paddle: integrations/builtin/app-nodes/n8n-nodes-base.paddle.md - PagerDuty: integrations/builtin/app-nodes/n8n-nodes-base.pagerduty.md @@ -989,6 +991,7 @@ nav: - integrations/builtin/credentials/opencti.md - integrations/builtin/credentials/openrouter.md - integrations/builtin/credentials/openweathermap.md + - integrations/builtin/credentials/oracledb.md - integrations/builtin/credentials/oura.md - integrations/builtin/credentials/paddle.md - integrations/builtin/credentials/pagerduty.md