# Databases CrushMFT can use

The server needs no database. Users, settings, jobs, shares, the record of who did what, the search catalog: everything is kept in plain files in the server's own folder. A new server has no database in it and no database driver.

There are a few places where the server can use a database **of yours**, if you have a reason to. This page lists them, so that the question "does it work with our SQL Server?" has one answer.

## Where a database can be used

| For | What it does | See |
|---|---|---|
| **users** | the server keeps its user accounts in tables of your database, in place of its files. Several servers can read the same users. | [User Config](Prefs-User-Config.md), [Users in a database](Prefs-User-Config-SQL.md), [the table scripts](Prefs-User-Config-Scripts.md) |
| **the log** | log lines are written into a table as well | [Logging to a database](Logging-Database.md) |
| **the record for reports** | what the server records about transfers and logins is also written to your database, for your own reporting tools. Enterprise licence. | [The store in a database](Reports-Store-SQL.md) |
| **jobs** | an SQL task reads from or writes to any database: look up an order, record a delivery | [SQL task](Task-SQL.md) |

In each of these the files remain the simpler choice, and the pages say so. Use a database when something outside the server needs the data there.

## Where a database is no longer used

| In earlier versions | In version 27 |
|---|---|
| the statistics database behind the reports, a Derby database inside the server | a record in files. An old statistics database can be read once, to bring its history over: [Importing from CrushFTP 11](Reports-Import-from-11.md). |
| the search index in a database | a catalog in files: [Search and the file index](Search-Index.md) |
| the record of sync | a journal in files |
| the CrushSQL plugin, for users in a database | a choice of the server itself: see **users** above, and [CrushSQL](Plugin-CrushSQL.md) |

## Which databases

Any database with a JDBC driver for Java. The forms offer these by name and fill in the driver's class for them:

| Database | Driver class | The address looks like |
|---|---|---|
| MySQL | `com.mysql.cj.jdbc.Driver` | `jdbc:mysql://db.example.com:3306/crushftp` |
| MariaDB | `org.mariadb.jdbc.Driver` | `jdbc:mariadb://db.example.com:3306/crushftp` |
| Microsoft SQL Server | `com.microsoft.sqlserver.jdbc.SQLServerDriver` | `jdbc:sqlserver://db.example.com:1433;databaseName=crushftp` |
| Oracle | `oracle.jdbc.OracleDriver` | `jdbc:oracle:thin:@db.example.com:1521/crushftp` |
| PostgreSQL | `org.postgresql.Driver` | `jdbc:postgresql://db.example.com:5432/crushftp` |

Which of them a form offers differs by form; the page of each use lists its own.

## The driver

The server does not come with any driver. You get it from the maker of your database: it is a `.jar` file.

1. Download the JDBC driver for your database and its version, for the Java your server runs on.
2. Put the file into the folder `plugins/lib` in the server's folder. A driver anywhere else is refused.
3. Restart the server once.
4. In the form, name the driver's class and choose the file.
5. Use the form's test button before you save.

The Derby driver is refused by the SQL task: "Derby driver is not allowed for SQLTask due to security risks."

If a driver in `plugins/lib` is not found after the restart, look at the [About](Admin-About.md) section of Server Admin: it lists files in that folder that are not the server's own, and says whether they were loaded.

## The database's side

- **An account for the server alone**, with rights on its own tables and nothing else. For the log and the report record, the right to insert is enough.
- **The tables.** For users, the server has scripts that make them: [the table scripts](Prefs-User-Config-Scripts.md). For the other uses, the page of each says what the table looks like.
- **Encryption on the way.** Turn on TLS between the server and the database, in the address, in the way your driver wants it. User tables hold password hashes.
- **Time.** Keep the clocks of the two machines together, and decide on one time zone for time columns.

## Things to know

- **A database that is down takes its use down with it.** With users in a database, nobody can log in while it is away. With the log or the report record in a database, the files go on; the page of each use says what happens to the lines meanwhile.
- **A slow database makes slow logins**, with users in a database: every login asks it.
- **Backups are yours.** The server's own backup covers its files, not your database.
- **In [FIPS mode](FIPS-Mode.md)**, a driver brings cryptography of its own that the mode does not cover. Read that page first.
- **In a cluster**, every server needs the driver file in its own `plugins/lib`.

## Not tried for this page

No database was connected for this page. It gathers what the pages of the four uses say; those say for themselves what was run.
