Documentation / Projects
Database connection
Supported engines, connection settings, the SSH tunnel and good practice for the database account OpenDB uses.
Supported engines
OpenDB connects to MySQL, MariaDB, PostgreSQL and SQLite.
A few differences worth knowing:
| Capability | MySQL / MariaDB | PostgreSQL | SQLite |
|---|---|---|---|
| Stop a long-running query | Yes | Yes | No |
| Estimated row count for large tables | Yes | Yes | No |
| Structure change rolled back on failure | No | Yes | No |
| Costs in the execution plan | Yes | Yes | No |
On MySQL and MariaDB, each structure statement is committed at once. A change made of several statements can therefore remain partly applied if one of them fails. The interface warns you about it.
Connection settings
| Setting | Purpose |
|---|---|
| Engine | MySQL, MariaDB, PostgreSQL or SQLite |
| Host and port | The address of the database server |
| Database | The database name, or the file path for SQLite |
| Username and password | The database account OpenDB uses |
The Test the connection button checks these settings before saving.
All of these settings are encrypted before they are stored. The password is never sent to the model: the agent only knows whether there is one.
SSH tunnel
Turn on the SSH tunnel when the database can only be reached through an intermediate server. OpenDB opens the tunnel before connecting, on a free local port, and closes it afterwards.
Remote database
When the database is on another server, the status bar of the project shows a Remote badge, or SSH behind a tunnel: every query makes a round trip over the network there, and can be slower. A database on your machine shows nothing. Every member of the project sees the badge, even those who cannot see the SSH settings.
Read-only project
In the SQL editor, the Read-only switch puts the project in a mode where only reads run. Use it when you work on a production database.
Change the connection
Project settings → Database lets you change a project's connection. The new connection is tested before it is saved.
Good practice
- Create a database account dedicated to OpenDB, with only the rights it needs. OpenDB's protections come on top of the account's rights, they do not replace them.
- Use a read-only account if nobody should write from OpenDB.
- Clone the database before handing it to a third-party AI provider. See Cloning and anonymization.
- Hide from the agent the tables it does not need. See Project settings.
How OpenDB protects the database
Whatever account is used, every query goes through several checks before it runs.
- Reads run in a read-only transaction at engine level.
- Administration operations (accounts, roles, privileges, databases, server) are always refused.
- One statement per call: stacked statements are refused.
- The user's privileges in OpenDB are checked on every query.
These checks are deliberately cautious. They sometimes refuse a legitimate query, for instance when the name of a hidden table appears inside a text value. See Security and privacy for details.