docs/docs/en/data-sources/data-source-manager/external-database.md
Use an existing external database as a data source. Currently supported external databases include MySQL, MariaDB, PostgreSQL, MSSQL, and Oracle.
After activating the plugin, you can select and add it from the "Add new" dropdown menu in data source management.
Fill in the information for the database you need to connect to.
After establishing a connection with an external database, all collections within the data source will be read directly. External databases do not support adding collections or modifying the table structure directly. If modifications are needed, you can perform them through a database client and then click the "Refresh" button in the interface to synchronize.
The external database will automatically read and display the fields of existing collections. You can quickly view and configure the field's title, data type (Field type), and UI type (Field interface). You can also click the "Edit" button to modify more configurations.
Because external databases do not support modifying the table structure, the only available type when adding a new field is the association field. Association fields are not actual fields but are used to establish connections between collections.
For more details, see the Collection Fields/Overview chapter.
NocoBase automatically maps the field types from the external database to the corresponding data type (Field type) and UI type (Field Interface).
| PostgreSQL | MySQL/MariaDB | NocoBase Data Type | NocoBase Interface Type |
|---|---|---|---|
| BOOLEAN | BOOLEAN | ||
| TINYINT(1) | boolean | checkbox | |
| switch | |||
| SMALLINT | |||
| INTEGER | |||
| SERIAL | |||
| SMALLSERIAL | TINYINT | ||
| SMALLINT | |||
| MEDIUMINT | |||
| INTEGER | integer | ||
| boolean | |||
| sort | integer | ||
| sort | |||
| checkbox | |||
| switch | |||
| select | |||
| radioGroup | |||
| BIGINT | |||
| BIGSERIAL | BIGINT | bigInt | |
| sort | integer | ||
| sort | |||
| checkbox | |||
| switch | |||
| select | |||
| radioGroup | |||
| unixTimestamp | |||
| createdAt | |||
| updatedAt | |||
| REAL | FLOAT | float | number |
| percent | |||
| DOUBLE PRECISION | DOUBLE PRECISION | double | number |
| percent | |||
| DECIMAL | |||
| NUMERIC | DECIMAL | decimal | number |
| percent | |||
| currency | |||
| VARCHAR | |||
| CHAR | VARCHAR | ||
| CHAR | string | ||
| password | |||
| uuid | |||
| nanoid | input | ||
| phone | |||
| password | |||
| color | |||
| icon | |||
| select | |||
| radioGroup | |||
| uuid | |||
| nanoid | |||
| TEXT | TEXT | ||
| TINYTEXT | |||
| MEDIUMTEXT | |||
| LONGTEXT | text | ||
| json | textarea | ||
| markdown | |||
| vditor | |||
| richText | |||
| url | |||
| json | |||
| UUID | - | uuid | uuid |
| JSON | |||
| JSONB | JSON | json | json |
| TIMESTAMP | DATETIME | ||
| TIMESTAMP | date | date | |
| time | |||
| createdAt | |||
| updatedAt | |||
| DATE | DATE | dateOnly | datetime |
| TIME | TIME | time | time |
| - | YEAR | datetime | |
| CIRCLE | circle | json | |
| circle | |||
| PATH | |||
| GEOMETRY(LINESTRING) | LINESTRING | lineString | Json |
| lineString | |||
| POINT | |||
| GEOMETRY(POINT) | POINT | point | json |
| point | |||
| POLYGON | |||
| GEOMETRY(POLYGON) | POLYGON | polygon | json |
| polygon | |||
| GEOMETRY | GEOMETRY | - | - |
| BLOB | BLOB | blob | - |
| ENUM | ENUM | enum | select |
| radioGroup | |||
| ARRAY | - | array | multipleSelect |
| checkboxGroup | |||
| BIT | BIT | - | - |
| SET | SET | set | multipleSelect |
| checkboxGroup | |||
| RANGE | - | - | - |
Unsupported field types are displayed separately. These fields require development adaptation before they can be used.
Collections displayed as blocks must have a Filter target key configured. The filter target key is used to filter data based on a specific field, and the field value must be unique. By default, the filter target key is the collection's primary key field. For views, collections without a primary key, or collections with a composite primary key, you need to define a custom filter target key.
Only collections that have a filter target key configured can be added to the page.