# IRPCVaultsAdmin.TestConnectionToSQLDatabase

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Administration API](https://developer.m-files.com/APIs/gRPC-API/admin/index.md) > [Vault management](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/TestConnectionToSQLDatabase/

Badges: `Administration API / specialized` `admin` `session` `idempotent`

Tests whether the server can connect to a Microsoft SQL Server database, for example before
creating a vault in it.

- **Service:** [Vault management](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/index.md) `MFiles.IRPCVaultsAdmin`
- **gRPC method:** `/MFiles.IRPCVaultsAdmin/TestConnectionToSQLDatabase`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/test-connection-to-sqldatabase`
- **Request:** [`TestConnectionToSQLDatabaseRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/TestConnectionToSQLDatabase/index.md#request)
- **Response:** [`TestConnectionToSQLDatabaseResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/TestConnectionToSQLDatabase/index.md#response)
- **Book and level:** Administration API, specialized
- **Kind:** admin
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** yes
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- Requires the system administrator server role (server right `manage_vaults`).
- Succeeds with an empty response if the connection works; fails with the connection error
  otherwise. The server tries once only, so a mistyped server name fails fast.

<a id="request"></a>

## Request: TestConnectionToSQLDatabaseRequest

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `sqldb` | [`SQLDatabase`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SQLDatabase/index.md) | The database server, database name and credentials to test. |
| `sqldb.engine` | [`DBEngine`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.DBEngine/index.md) | Database engine identification. Values: `DBENGINE_NONE` (0), `DBENGINE_FIREBIRD` (1), `DBENGINE_MS_SQL_SERVER` (2). |
| `sqldb.server_name` | `string` | The data source i.e. the database server name where the vault's database is residing. This is specified for data service DB engines only. It is empty or unset for embedded databases such as Firebird Embedded. |
| `sqldb.database_name` | `string` | The catalog i.e. the database name where the vault's data is residing. Allows the database name to differ from the vault display name. This is not specified in the Firebird case. |
| `sqldb.system_admin_impersonation` | [`Impersonation`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Impersonation/index.md) | Impersonation information for accessing the database engine for administrative purposes. This contains SYSDBA (System Database Administrator) user name and password. If unset, the default user name and password are used. |
| `sqldb.system_admin_impersonation.type` | [`ImpersonationType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.ImpersonationType/index.md) | Impersonation type. Values: `IMPERSONATION_TYPE_SYSTEM_ACCOUNT` (0), `IMPERSONATION_TYPE_LOCAL_WINDOWS_ACCOUNT` (1), `IMPERSONATION_TYPE_EXTERNAL_ACCOUNT` (2). |
| `sqldb.system_admin_impersonation.account` | `string` | Account name (e.g. DOMAIN\user). |
| `sqldb.system_admin_impersonation.encrypted_password` | `bytes` | Encrypted password. |
| `sqldb.basic_user_impersonation` | [`Impersonation`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Impersonation/index.md) | Impersonation information for accessing the database engine in basic user operations that do not modify the database structure. This contains DB user name and password. If unset, the default user name and password are used. |
| `sqldb.basic_user_impersonation.type` | [`ImpersonationType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.ImpersonationType/index.md) | Impersonation type. Values: `IMPERSONATION_TYPE_SYSTEM_ACCOUNT` (0), `IMPERSONATION_TYPE_LOCAL_WINDOWS_ACCOUNT` (1), `IMPERSONATION_TYPE_EXTERNAL_ACCOUNT` (2). |
| `sqldb.basic_user_impersonation.account` | `string` | Account name (e.g. DOMAIN\user). |
| `sqldb.basic_user_impersonation.encrypted_password` | `bytes` | Encrypted password. |
| `database_should_exist` | `bool` | True to also fail if the database does not exist. False accepts both an existing and a missing database (a new vault can use an existing empty database). |

<a id="response"></a>

## Response: TestConnectionToSQLDatabaseResponse

No fields.
