---
sidebar_label: n8n
slug: /n8n
---

# Integrate seekdb vector search with n8n

n8n is a workflow automation platform with native AI capabilities, providing technical teams with the flexibility of code and the speed of no-code. With over 400 integrations, native AI features, and a fair code license, n8n allows you to build a robust automation while maintaining full control over your data and deployments.

This topic demonstrates how to build a Chat to seekdb workflow template using the powerful features of n8n.

## Prerequisites

* You have deployed seekdb.

* This integration tutorial is performed in a Docker container. Make sure that you have [set up a Docker container](https://docs.docker.com/get-started/get-docker/).

## Step 1: Obtain the database connection information

Contact the seekdb deployment personnel or administrator to obtain the database connection string, for example:

```sql
mysql -h$host -P$port -u$user_name -p$password -D$database_name
```

**Parameters:**

* `$host`: The IP address for connecting to the seekdb database.
* `$port`: The port for connecting to the seekdb database. The default value is `2881`.
* `$database_name`: The name of the database to access.

    :::tip

    The user connecting to the database must have the `CREATE`, `INSERT`, `DROP`, and `SELECT` privileges on the database.

    :::


* `$user_name`: The database account.
* `$password`: The password for the account.

## Step 2: Create a test table and insert data

Before you build the workflow, you need to create a sample table in seekdb to store book information and insert some sample data.

```sql
CREATE TABLE books (
    id VARCHAR(255) PRIMARY KEY,
    isbn13 VARCHAR(255),
    author TEXT,
    title VARCHAR(255),
    publisher VARCHAR(255),
    category TEXT,
    pages INT,
    price DECIMAL(10,2),
    format VARCHAR(50),
    rating DECIMAL(3,1),
    release_year YEAR
);

INSERT INTO books (
    id, isbn13, author, title, publisher, category, pages, price, format, rating, release_year
) VALUES (
    'database-internals',
    '978-1492040347',
    '"Alexander Petrov"',
    'Database Internals: A deep-dive into how distributed data systems work',
    'O\'Reilly',
    '["databases","information systems"]',
    350,
    47.28,
    'paperback',
    4.5,
    2019
);

INSERT INTO books (
    id, isbn13, author, title, publisher, category, pages, price, format, rating, release_year
) VALUES (
    'designing-data-intensive-applications',
    '978-1449373320',
    '"Martin Kleppmann"',
    'Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems',
    'O\'Reilly',
    '["databases"]',
    590,
    31.06,
    'paperback',
    4.4,
    2017
);

INSERT INTO books (
    id, isbn13, author, title, publisher, category, pages, price, format, rating, release_year
) VALUES (
    'kafka-the-definitive-guide',
    '978-1491936160',
    '["Neha Narkhede", "Gwen Shapira", "Todd Palino"]',
    'Kafka: The Definitive Guide: Real-time data and stream processing at scale',
    'O\'Reilly',
    '["databases"]',
    297,
    37.31,
    'paperback',
    3.9,
    2017
);

INSERT INTO books (
    id, isbn13, author, title, publisher, category, pages, price, format, rating, release_year
) VALUES (
    'effective-java',
    '978-1491936160',
    '"Joshua Block"',
    'Effective Java',
    'Addison-Wesley',
    '["programming languages", "java"]',
    412,
    27.91,
    'paperback',
    4.2,
    2017
);

INSERT INTO books (
    id, isbn13, author, title, publisher, category, pages, price, format, rating, release_year
) VALUES (
    'daemon',
    '978-1847249616',
    '"Daniel Suarez"',
    'Daemon',
    'Quercus',
    '["dystopia","novel"]',
    448,
    12.03,
    'paperback',
    4.0,
    2011
);

INSERT INTO books (
    id, isbn13, author, title, publisher, category, pages, price, format, rating, release_year
) VALUES (
    'cryptonomicon',
    '978-1847249616',
    '"Neal Stephenson"',
    'Cryptonomicon',
    'Avon',
    '["thriller", "novel"]',
    1152,
    6.99,
    'paperback',
    4.0,
    2002
);

INSERT INTO books (
    id, isbn13, author, title, publisher, category, pages, price, format, rating, release_year
) VALUES (
    'garbage-collection-handbook',
    '978-1420082791',
    '["Richard Jones", "Antony Hosking", "Eliot Moss"]',
    'The Garbage Collection Handbook: The Art of Automatic Memory Management',
    'Taylor & Francis',
    '["programming algorithms"]',
    511,
    87.85,
    'paperback',
    5.0,
    2011
);

INSERT INTO books (
    id, isbn13, author, title, publisher, category, pages, price, format, rating, release_year
) VALUES (
    'radical-candor',
    '978-1250258403',
    '"Kim Scott"',
    'Radical Candor: Be a Kick-Ass Boss Without Losing Your Humanity',
    'Macmillan',
    '["human resources","management", "new work"]',
    404,
    7.29,
    'paperback',
    4.0,
    2018
);
```

## Step 3: Deploy the tools

### Private deployment of n8n

n8n is a workflow automation platform based on Node.js. It provides extensive integration capabilities and flexible extensibility. By privately deploying n8n, you can better control the runtime environment of your workflows and ensure the security and privacy of your data. This section describes how to deploy n8n in a Docker environment.

```shell
sudo docker run -d   --name n8n   -p 5678:5678   -e N8N_SECURE_COOKIE=false   n8nio/n8n
```

### Deploy the Qwen3 model using Ollama

Ollama is an open-source AI model server that supports the deployment and management of multiple AI models. With Ollama, you can easily deploy the Qwen3 model locally to enable AI Agent functionality. This section describes how to deploy Ollama in a Docker environment, and then use Ollama to deploy the Qwen3 model.

```shell
# Deploy Ollama in a Docker environment
sudo docker run -d  -p 11434:11434 --name ollama ollama/ollama
# Deploy the Qwen3 model
sudo docker exec -it ollama sh -c 'ollama run qwen3:latest'
```

## Step 4: Build an AI Agent workflow

n8n provides a variety of nodes to build an AI Agent workflow. This section shows you how to build a Chat to seekdb workflow template. The workflow consists of five nodes, and the steps are as follows:

1. Add a trigger

    Add an HTTP trigger node to receive HTTP requests.

    ![](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/n8n-1.png)

2. Add an AI Agent node

    Add an AI Agent node to process AI Agent requests.

    ![](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/n8n-2.png)

3. Add an Ollama Chat Model node

    Select a free Ollama chat model, such as Qwen3, and configure the Ollama account.

    ![](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/n8n-4.png)

    ![](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/n8n-3.jpg)

4. Add a Simple Memory node

    The Simple Memory node indicates short-term memory and can remember the previous five interactions in the chat.

    ![](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/n8n-5.png)

5. Add a Tool node

    The Tool node is used to perform database operations in seekdb. Add a MySQL tool under AI Agent-tool.

    ![](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/n8n-6.png)

    Configure the MySQL tool as follows:

    ![](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/n8n-8-1.png)

    Click the edit icon shown in the preceding figure to configure the MySQL connection information.

    ![](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/n8n-7-1.png)

    After the configuration is completed, close the window. Click **Test step** in the upper-right corner of the configuration panel to test the database connection with a simple SQL statement, or click **Back to canvas** to return to the main interface.

6. Click **Save** to complete the workflow construction.

    After all 5 nodes are configured, click **Save** to complete the workflow construction. You can then test the workflow.

    <!-- ![](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/n8n-9.png) -->

## Workflow demo

The completed workflow is displayed as follows:

![](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/n8n-%E5%B1%95%E7%A4%BA%EF%BC%88%E9%AB%98%E6%B8%85%EF%BC%89.png)