Database Connectors
Description
Section titled “Description”This directory contains auxiliary modules for direct connection to external databases. They are not independent workflow nodes with metadata.json, but function libraries that other modules can use to execute queries against third-party databases.
Each connector exposes a query function that receives the connection configuration, the query and parameters, and returns the results.
Available Connectors
Section titled “Available Connectors”PostgreSQL (postgresql.js)
Section titled “PostgreSQL (postgresql.js)”Uses the pg (Pool) library. Accepts configuration with host, user, database, password, port. Executes parameterized queries and returns result.rows.
MySQL (mysql.js)
Section titled “MySQL (mysql.js)”Uses the mysql2/promise library. Creates a connection, executes the query with execute and returns the resulting rows.
MongoDB (mongodb.js)
Section titled “MongoDB (mongodb.js)”Uses the mongodb (MongoClient) library. Requires configuration with url and database. The query function receives the collection name and a filter, executes find(filter).toArray().
SQL Server (sqlserver.js)
Section titled “SQL Server (sqlserver.js)”Uses the mssql library. Requires configuration with user, password, server, database. Executes SQL queries and returns result.recordset.
Configuration
Section titled “Configuration”| Parameter | Type | Required | Description |
|---|---|---|---|
| host / server / url | text | Yes | Database server address |
| user / username | text | Yes | Database user |
| password | text | Yes | Password |
| database | text | Yes | Database name |
| port | number | No | Connection port |
Usage Example
Section titled “Usage Example”PostgreSQL
Section titled “PostgreSQL”const pg = require('./conectores/postgresql');const rows = await pg.query( { host: 'localhost', user: 'admin', database: 'mydb', password: 'pass', port: 5432 }, 'SELECT * FROM users WHERE status = $1', ['active']);const mysql = require('./conectores/mysql');const rows = await mysql.query( { host: 'localhost', user: 'root', password: 'pass', database: 'mydb' }, 'SELECT * FROM orders WHERE id = ?', [123]);MongoDB
Section titled “MongoDB”const mongo = require('./conectores/mongodb');const docs = await mongo.query( { url: 'mongodb://localhost:27017', database: 'mydb' }, 'users', { status: 'active' });SQL Server
Section titled “SQL Server”const mssql = require('./conectores/sqlserver');const rows = await mssql.query( { user: 'sa', password: 'pass', server: 'localhost', database: 'mydb' }, 'SELECT TOP 10 * FROM Products');- These modules do not have metadata.json and do not appear as nodes in the visual editor
- They are low-level utilities intended to be used by other workflow modules
- Connections are automatically closed after each query
- PostgreSQL uses Pool which closes with pool.end()
- MySQL creates a new connection per query and closes it upon completion
- MongoDB uses MongoClient.connect and closes with client.close()
- SQL Server uses mssql.connect and manages the pool internally
- They do not include integrated credential management; configuration is passed directly
Related Nodes
Section titled “Related Nodes”- Integration modules that require direct access to external databases